title: Resolving promises inside for loop
body: <p>I am trying to read a JSON object using a for loop to format the JSON data and send it back to the client by putting the formatted response into a model object.</p>
  
  <p>Inside for loop, i am dealing with two promises based upon few conditions. There are two functions, each having a promise returned.How can I get my final data after all the promises are resolved? Thanks in advance.</p>
  
  <pre><code>for (var i = 0, i&lt;jsonData.length; i++){
     if(someCOndition){
         getSomeData().then(function(data){
            //some operation using data
         })
     }
    if(someOtherCOndition){
         getSomeOtherData().then(function(data){
            //some operation using data
         })
     }
  }
  </code></pre>