Rakesh Rakesh - 5 months ago 21
Javascript Question

Pass parameters in setInterval function

How to pass parameter while call a function using setInterval.
viz.

setInterval('funca(10,3)',500);
is incorrect.

Answer

You need to create an anonymous function so the actual function isn't executed right away.

setInterval( function() { funca(10,3); }, 500 );
Comments