title: Javascript: How to put a simple delay in between execution of javascript code?
body: <p>I have a for loop which iterates more than 10,000 times in a javascript code. The for loop creates and adds &lt; div > tags into a box in the current page DOM. </p>
  
  <pre><code>for(i = 0; i &lt; data.length; i++)
  {
      tmpContainer += '&lt;div&gt; '+data[i]+' &lt;/div&gt;';
      if(i % 50 == 0) { /* some delay function */ }
  }
  containerObj.innerHTML = tmpContainer;
  </code></pre>
  
  <p>i want to put a delay after every 50 &lt; div > tags so what will be the code at the place of</p>
  
  <pre><code>/* some delay function */
  </code></pre>
  
  <p>because its taking too much time to load all 10,000 &lt; div > tags. i want to update the box in chunks of 50 &lt; div > tags.</p>
  
  <p>thanks in advance.</p>