Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const promisesWithoutReject = [
Promise.resolve('๐ŸŽ #1'),
'๐ŸŽ #2',
new Promise((resolve, reject) => setTimeout(resolve, 100, '๐ŸŽ #3'))
.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 ๐Ÿ'))
.catch(badApple =>
console.error(`Threw out all apples because of this`, badApple))
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