Promise.all()

In JavaScript, you can use Promise.all() if you need to wait for a few promises to complete before moving forward in a routine.

var p1 = getData(); // getData returns a promise with some data when it completes.
var p2 = 42;
var p3 = new Promise(function(resolve, reject) {
    setTimeout(resolve, 100, 'a fake promise')
});

Promise.all([p1, p2, p3]).then(function(promiseResults) {
    console.log(promiseResults);
    // promiseResults will contain an in-order array of the results of `getData()`, 42, and 'a fake promise' 
});

For more information, check out the Mozilla Developer Network.