+ 1
//JavaScript can some please explain to me how this code equal 24
var a="1"; var b="2*2"; console.log(eval(a+b)); Output //24 Why Please explain
1 Answer
+ 1
George S Mulbah
If you add this line to your snippet above - console.log(a+b)
The output this would be 12*2 and this what the eval function see also.
And of course, the rest is math.