set interval time in for loop

by mariganesh 2013-01-25 16:45:42

set interval time in for loop

Here is the for loop has to be changed to setinterval function.

For loop



for(var counter=0;counter<=10;counter++)
{
// do your thing
}


setinterval function


var counter = 0;
var i = setInterval(function(){

if(counter <= 10) {
// do your thing

counter++;
}
else
clearInterval(i);

}, 200);
485
like
0
dislike
0
mail
flag

You must LOGIN to add comments