title: JavaScript : For loop with timeout
body: <p>I want that my for loop should not be executed at once, but wait for timeout after each iteration. For eg : </p>
  
  <pre><code>for(var i=0; i&lt;10; i++) {
      console.log(i);
      //wait for 1000
  }
  </code></pre>
  
  <p>I found many solutions on stack-overflow like this one : </p>
  
  <pre><code>for (var i=0;i&lt;=10;i++) {
     (function(ind) {
         setTimeout(function(){console.log(ind);}, 3000);
     })(i);
  }
  </code></pre>
  
  <p>But in all the implementations, the loop waits for 3000 milli-seconds initially and then executes the whole <code>for</code> loop at once. Is there a way that each iteration is called after waiting for 1000 milli-seconds.</p>