Promise.call

const promise1 = Promise.resolve(3);
const promise2 = 42;
const promise3 = new Promise((resolve, reject) => {
setTimeout(resolve, 100, 'foo');
});

Promise.all([promise1, promise2, promise3]).then((values) => {
console.log(values);
});
// expected output: Array [3, 42, "foo"]

 

 //等.all()括号传入的promise全部为成功状态返回一个promise实例,如果有失败的话 返回第一个失败的结果

posted @ 2020-08-05 22:33  幽悠又  阅读(369)  评论(0编辑  收藏  举报