Created
May 2, 2018 18:34
-
-
Save djmarland/77fffb5b0fe5473797901fad1872a9b6 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, 'p1_delayed_resolvement'); | |
}); | |
var p2 = new Promise((resolve, reject) => { | |
reject(new Error('p2_immediate_rejection')); | |
}); | |
Promise.all([ | |
p1.catch(error => { return error }), | |
p2.catch(error => { return error }), | |
]).then(values => { | |
console.log(values[0]) // "p1_delayed_resolvement" | |
console.log(values[1]) // "Error: p2_immediate_rejection" | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment