title: How to implement nested q promise in node js?
body: <p>Can we implement following q promise nesting in node js? If we cannot, are there any alternatives to achieve the following?</p>
  
  <pre><code>var array1 =[--*some data*--];
  var array2=[],array4=[];
  
  for(var i=0;i&lt;array.length;i++)
  {
   var promise1 = generatePromise1();
   array2.push(promise1); 
  }
  
  Q.all(array2).then(function(array3){
   for(var j=0;j&lt;array3.length;j++)
   {
    var promise2 = generatePromise2();
    array4.push(promise2);
   }
  
   Q.all(array3).then(function(array4){
    return array4;
   })
  })
  </code></pre>