Skip navigation

Monthly Archives: December 2010

You might be knowing how to call setTimeout javascript function. It is simple
setTimeout(myFunction, myTimeoutInMilliSeconds);

But if you want to pass a parameter with myFunction
setTimeout(myFunction(para), myTimeoutInMilliSeconds); // won't work

The javascript closure comes as a great rescue.
setTimeout(function(){myFunction(para)}, myTimeoutInMilliSeconds);

This is best example of using closure.


Get every new post delivered to your Inbox.

Join 216 other followers