title: Wait for response inside for loop
body: <p>I have below code which is making an third party api call using <code>request</code> npm</p>
  
  <pre><code>const array = []
  for (var i = 0; i &lt; 10; i++) {
    request('api_call', function(err, res) {
      array.push(res)
    })
  }
  console.log(array)
  </code></pre>
  
  <p>But didn't get anything in the array.</p>
  
  <p>Can someone please help how can I wait for all the 10 api calls?</p>