+ 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

26th Nov 2018, 10:02 AM
UwU Discover Me
15 Réponses
26th Nov 2018, 10:14 AM
Calviղ
Calviղ - avatar
+ 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
26th Nov 2018, 11:18 AM
Calviղ
Calviղ - avatar
+ 2
Calviղ, does this mean that console.log method accepts not more than one argument?
26th Nov 2018, 10:32 AM
Umeozulu Tochukwu
Umeozulu Tochukwu - avatar
+ 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
26th Nov 2018, 11:14 AM
Calviղ
Calviղ - avatar
+ 2
Calviղ Basil yes it was not working in solo learn but it was working in my editor. May be it's a bug in sololearn
26th Nov 2018, 11:21 AM
UwU Discover Me
+ 1
Cool discovery.
26th Nov 2018, 7:58 PM
Umeozulu Tochukwu
Umeozulu Tochukwu - avatar
+ 1
Calviղ, what is this expression ("%i%i") called so I can look it up?
26th Nov 2018, 8:01 PM
Umeozulu Tochukwu
Umeozulu Tochukwu - avatar
+ 1
%Basil %i is a placeholder, it would be replace by the argument integer. For string use %s.
27th Nov 2018, 12:28 AM
Calviղ
Calviղ - avatar
0
Calvin answer will be 10
26th Nov 2018, 10:16 AM
UwU Discover Me
0
dont miss out '' +
26th Nov 2018, 10:21 AM
Calviղ
Calviղ - avatar
0
Yah its fine but why it's displaying like that
26th Nov 2018, 10:22 AM
UwU Discover Me
0
4 + 6 = 10
26th Nov 2018, 10:26 AM
Calviղ
Calviղ - avatar
0
4 + '' + 6 = '46'
26th Nov 2018, 10:26 AM
Calviղ
Calviղ - avatar
0
4, 6 would only show 4, ignore second argument
26th Nov 2018, 10:27 AM
Calviղ
Calviղ - avatar
0
Basil good question
26th Nov 2018, 10:41 AM
UwU Discover Me