1. Home
  2. Javascript
  3. Delayed iteration loop
#javascript#loop

Using setTimeout function this loop example lets you delay the iteration.

(function iterate(i) {          
    setTimeout(function () {   
       console.log(i);                     
       if (--i) iterate(i);      
    }, 200)
 })(10);
copy
Full Javascript cheatsheet
Sitemap Git repository