I have a for loop which iterates more than 10,000 times in a javascript code. The for loop creates and adds < div > tags into a box in the current page DOM.
You could use the window.setTimeout function to delay the execution of some code:
if(i % 50 == 0) { window.setTimeout(function() { // this will execute 1 second later }, 1000); }
But your javascript will continue to execute. It won't stop.