Promise.allSettled & Promise.all & Promise.race & Promise.any All In One new Promise(), Promise.resolve(), Promise.reject(), Promise.prototype.catch() Promise.prototype.finally() Promise.prototype.then() Promise https://developer.mozilla.org/e
可以满足需求,且使用方法和Promise.all统一 var a = function() { return new Promise(function(resolve, reject) { setTimeout(function() { console.log('a') resolve('a') }, 1000) }) } var b = function(data) { return new Promise(function(resolve, reject) { console.log('b'
function pri (num) { return new Promise((resolve,reject) => { console.log('开始'+num) resolve(num) }) } const list = [1,2,3] function done(list,cb){ list.reduce((s,v) => { return s.then(res => { console.log(res) if (re