0

Hi everyone, why the result of console.log(eval("2*2"+4)) equal 48 ?

20th Aug 2019, 4:46 PM
Hjjko
2 Antworten
+ 3
Since you are concatenating a string and number js tries to coerce the int into str which results in "2*24" which is then evaluated by eval as 48.
20th Aug 2019, 5:07 PM
Ray
+ 1
Dam Javascript🤦‍♂️
20th Aug 2019, 6:16 PM
Trigger
Trigger - avatar