+ 3
eval ()
need help! who can explain step by step var a = "2*3"; var b = 5; var c = eval(b+a); document.write(c);
6 Antworten
+ 8
(Really??…)
+ 7
eval() executes a string as pure javascript.
(c = 5 + 2 * 3)
+ 5
In fact, eval(expr) firstly evaluate the expression passed in argument, and secondly eval the string, if the argument resulting is a string ( else return the argument unchanged ). So, argument in this case is b+a, wich is equal to "52*3" ( concanetation of "5" et "2*3" ), that's count 156 ^^
+ 2
@visph is correct, 156.
+ 2
thanks guys
+ 1
156?