Created
June 24, 2016 03:15
-
-
Save DavidStrada/32bbf371a1b9fbf9d4c446a6fb56114e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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