title: How to Wait on Async function inside array.forEach in Javascript
body: <p>I am trying to make an <code>async</code> request within <code>foreach</code> to fetch data in order user it later but its not working for me.</p>
  
  <p>I know <code>Array.Foreach</code> is a synchronous function so I even tried $.when.done but still it does not wait until it finish.</p>
  
  <p>I could have used callback if it was a single value but its an array .
  Is there a better way to handle this by callback to achieve waiting on <code>async</code> request before moving next?    </p>
  
  <pre><code>browseItems.forEach((browseItem: any) =&gt; {
  
     AsynchFunction();
  
     cosole.log("Step 2")  
  }
  function AsynchFunction(){
     console.log("Step 1")
  }
  </code></pre>
  
  <p>I am trying to get an output like</p>
  
  <p>Step 1</p>
  
  <p>Step 2</p>