Javascript Promises in For Loops
<p>I'm struggling to get the following Promise logic right:</p>

<p>I call a ReST API which returns an array of objects. I then need to loop through this array and start building a new array of objects with some of the data. This all works fine, so far.</p>

<p>Within the data I get from the API response, there are 2 id fields (in each object), for which I need to make subsequent API calls. When I get the data back from each of these calls, I add some more data to my new object. Only then, should the <code>For</code> loop continue.</p>

<p>I've tried using <code>Promises</code>, but for some reason the <code>For</code> loop continues, while the <code>Promise</code> is still busy. Any ideas?</p>