Skip to content

Instantly share code, notes, and snippets.

@luanvuhlu
Created January 2, 2018 15:03
Show Gist options
  • Save luanvuhlu/22364c36c3b43a6d7a444478380495dc to your computer and use it in GitHub Desktop.
Save luanvuhlu/22364c36c3b43a6d7a444478380495dc to your computer and use it in GitHub Desktop.
Promise all
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
.catch(e => console.log(e));
var console = { log: msg => div.innerHTML += msg + "<br>"};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment