1

I'm currently struggling with making multiple (some number) setInterval() with different arguments. My code so far:

setInterval( function() { spinCheck(thisIS[0]); }, 100 );
setInterval( function() { spinCheck(thisIS[1]); }, 100 );
setInterval( function() { spinCheck(thisIS[2]); }, 100 );
setInterval( function() { spinCheck(thisIS[3]); }, 100 );
// thisIS[x] is argument array from somewhere else

Basically this is giving me results as long as I dont change number of arguments. Because of that I need something like this.

for(i=0;i<3;i++){
   setInterval( function() { spinCheck(thisIS[i]); }, 100 );
}

My goal is to return x number of setInterval() without adding more piece of code. Obviously this doesnt work, so I would appreciate any help ;)

0 Answers0