I have something code like:
for(var i=0; i<1000; i++)
{
do_something();
if(i == 500)
{
//STOP THIS FOR LOOP FOR 2s
do_this_function();
}
}
How can i simulate this STOP? This stop should work only when i is 500, in other i should just do for loop. I tried use setTimeout, delay, wait, but this stop just this function, dont stop the entire loop.
Maybe should i use recursive function instead of for? Is there another way?