Eli : Memcached, MySQL, Highcharts

Javascript function setInterval() with custom parameters

Javascript method

The setInterval() method calls a function or evaluates an expression at specified intervals in milliseconds
One tricky thing is passing parameters to the function called as documentation is hard to find.

Passing Parameters to setInterval()

Make an anonymous function inside setInterval()

function load(functionParameter) {
    //function called by setInterval()
}
...
var customParameter;
setInterval(function() { load(customParameter); },  1000);


Hope this help you save time

Related Posts





comments powered by Disqus

You may also be interested in