Edit in JSFiddle

function getUser(id) {
  return Q.delay(1000)
          .thenResolve({id: id, name: 'User ' + id});
}

var userPromises = [1,2,3].map(getUser);

Q.all(userPromises)
 .then(function (users) {
   alert('we got ' + users.length + ' users');
 });

              
            
          
            
              
                

              
            
          
            
              

External resources loaded into this fiddle: