読者です 読者をやめる 読者になる 読者になる

promise all execute

var a = () => Promise.resolve(1);
var b = () => Promise.reject(new Error(2));
var c = () => Promise.resolve(3);

Promise.all([a(), b(), c()].map(p => p.catch(e => e)))
.then(results => console.log(results)) // 1,Error: 2,3
.then*1
.then(results => alert('a'))
.catch(e => console.log(e));

stackoverflow.com

 

stackoverflow.com

*1:) => Promise.all([a(), b(), c()].map(p => p.catch(e => e)))) // 1,Error: 2,3
.then(results => console.log(results