setTimeout and setInterval act as eval. - TerryLee7788/JS_test GitHub Wiki

setTimeout and setInterval act as eval.

The browser provides setTimeout and setInterval functions that can take string arguments or function arguments. 
When given string arguments, setTimeout and setInterval act as eval. 
The string argument form also should be avoided.

JS code

var obj = {};
obj.a = 10;

var value = 'obj.a';  // 'obj.a'
eval(value)           // 10
setTimeout(value)     // 也是數字... 但不知道怎麼會被往上加@@...