+ 1

I seriously don't know why the output is 24 and not 14 any idea ? var a="1"; var b="2*2"; console.log(eval(a+b));

Javascript challenge question

3rd Jun 2020, 5:38 PM
Silva Olushola Fredrick
Silva Olushola Fredrick - avatar
2 Antworten
+ 6
a + b == "1" + "2*2" == "12*2" Keep in mind that before doing `eval`, you are adding strings, not numbers.
3rd Jun 2020, 5:47 PM
Schindlabua
Schindlabua - avatar
0
3rd Jun 2020, 5:48 PM
Silva Olushola Fredrick
Silva Olushola Fredrick - avatar