-
-
Save Noitidart/768b78c07a9af333a42ff1bc774ba72a 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
function sayHello() { | |
return new Promise( (resolve,reject) => { | |
reject('rawr') | |
}); | |
} | |
new Promise((resolve, reject) => sayHello()).then(ok => console.log('ok:', ok)).catch( err => console.error('err:', err) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have
rejected
only the Promise returned insayHello
function. You have not eitherresolved
norrejected
the outer promise on line 6. Hence yourthen
orcatch
block won't execute.