title: How to add setTimeout function for the Foreach loop
body: <p>Hi want to set the timeout funtion for the Freach loop for the callback i am setting the timeout funtion. but its displaying Undifined error. can anybody Explain me here is My code. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function async(array,cb){
  
      array.forEach(function () {
          setTimeout(cb,0);
  
      })
  
  }
  
  async([1,2,3,4],function(i){
      console.log(i);
  });</code></pre>
  </div>
  </div>
  </p>