Promise.all([
new Promise((resolve,reject)=>{
setTimeout(()=>{
resolve("hello gaojl");
},1000)
}),new Promise((resolve,reject)=>{
setTimeout(()=>{
resolve("hello gaojl")
},1000)
})
]).then((results)=>{
console.log(results[0]);
console.log(results[1]);
})
new Promise((resolve,reject)=>{
setTimeout(()=>{
resolve("hellogaojl");
},1000)
}).then((res)=>{
console.log(res);
return Promise.resolve(res+'aaa');
}).then((res)=>{
console.log(res);
})
Promise
最新推荐文章于 2023-04-08 22:43:10 发布