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
const promisesWithoutReject = [ | |
Promise.resolve('๐ #1'), | |
'๐ #2', | |
new Promise((resolve, reject) => setTimeout(resolve, 100, '๐ #3')) | |
] | |
Promise.all(promisesWithoutReject) | |
.then(apples => console.log(`We can sell all these good apples`, apples)) | |
const promisesWithOneReject = [ | |
Promise.resolve('๐ #1'), | |
'๐ #2', | |
new Promise((_, reject) => setTimeout(reject, 100, 'Bad ๐')) | |
] | |
Promise.all(promisesWithOneReject) | |
.then(console.log) | |
.catch(badApple => | |
console.error(`Threw out all apples because of this`, badApple)) |
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
We can sell all these good apples [ '๐ #1', '๐ #2', '๐ #3' ] | |
Threw out all apples because of this Bad ๐ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment