+ 2
Problem with Object-assign property in es6
Why I'm not getting 6 after 4 with console.log() method but since it's fine with document.Write() method.🤔🤔🤔🤔 https://code.sololearn.com/W4tp2I8925az/?ref=app
15 Answers
+ 2
replace, with +'' +
https://code.sololearn.com/W7MlW8UPs03l/?ref=app
+ 3
Anyway Code playground doesn't come with standard console log. we should test it on browser.
Pablo Escobar ll if you test console. log(a, b) : on browser, it would print 46
+ 2
Calviղ, does this mean that console.log method accepts not more than one argument?
+ 2
Basil if we pass console. log with arguments, it treats the second and onward arguments as substitutions.
it would substitute the placeholder in first argument string
for example
var a = 4;
var b = 6;
console.log("%i%i",a,b); // print 46
+ 1
Cool discovery.
+ 1
Calviղ, what is this expression ("%i%i") called so I can look it up?
+ 1
%Basil %i is a placeholder, it would be replace by the argument integer. For string use %s.
0
Calvin answer will be 10
0
dont miss out '' +
0
Yah its fine but why it's displaying like that
0
4 + 6 = 10
0
4 + '' + 6 = '46'
0
4, 6 would only show 4, ignore second argument
0
Basil good question