title: Wait promise inside for loop
body: <pre><code>let currentProduct;
  
  for (let i = 0; i &lt; products.length; i++) { 
      currentProduct = products[i];
  
      subscription.getAll(products[i]._id)
          .then((subs) =&gt; {
              update(subs, currentProduct);
          });
  }
  </code></pre>
  
  <p>I'm using bluebird, the methods <strong>getAll</strong> and <strong>update</strong> return promises. How can I say "Wait until the two promises return, then update the currentProduct value"? I'm quite new to JS...</p>