Skip to content

Instantly share code, notes, and snippets.

@DavidStrada
Created June 24, 2016 03:15
Show Gist options
  • Save DavidStrada/32bbf371a1b9fbf9d4c446a6fb56114e to your computer and use it in GitHub Desktop.
Save DavidStrada/32bbf371a1b9fbf9d4c446a6fb56114e to your computer and use it in GitHub Desktop.
var p1 = new Promise((resolve, reject) => {
setTimeout(resolve, 1000, "one");
});
var p2 = new Promise((resolve, reject) => {
setTimeout(resolve, 2000, "two");
});
var p3 = new Promise((resolve, reject) => {
setTimeout(resolve, 3000, "three");
});
var p4 = new Promise((resolve, reject) => {
setTimeout(resolve, 4000, "four");
});
var p5 = new Promise((resolve, reject) => {
setTimeout(reject, 6000, "reject"); //reject("reject");
});
Promise.all([p1, p2, p3, p4, p5]).then(value => {
console.log(value);
}, function(reason) {
console.log(reason, "reason")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment