Promise.all var fetch1 = function () { return new Promise(function (resolve, reject) { setTimeout(function () { resolve("1") }, 2000) }) }; var fetch2 = function () { return new Promise(function (resolve, reject) { setTimeout(function () { resolve("2") }, 1000) }) }; Promise.all([fetch1(),fetch2()]).then(function(res,b){ console.log(res)//['1','2'] })
Promise.all