title: Looping with Promises in JS
body: <p>I am trying to run queries inside a for loop in nodejs and each iteration of the for loop runs one query. The queries are done with a "get()" method that returns a Promise. In my function (that contains this for loop), I am returning the promise returned by the get() method like so:</p>
  
  <p><code>for(var i=0; i &lt; productIds.length; i++) {
  return queryObject.get(productIds[i]).then(//handle result)
  }</code></p>
  
  <p>but this returns after the first iteration and doesn't continue for the rest of the iterations. How do I solve this issue?</p>
  
  <p>For context, I am using Parse's Cloud Functions.</p>