It:
setTimeout('doSomething(var1)', 10000);
will pass the global variable var1 ,
And this:
setTimeout(function() { doSomething(var1); }, 10000);
will pass the local variable var1 .
Live demo: http://jsfiddle.net/simevidas/EQMaz/
Ε ime Vidas
source share