Created
January 21, 2016 14:15
-
-
Save oreillyross/19b25567653deeb8f8be to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let myPromise = new Promise((resolve,reject) => { | |
if( /* something is */ true ) { | |
resolve('Everything worked'); | |
} | |
else { | |
reject('Something went wrong'); | |
} | |
}); | |
myPromise.then(resolved => { | |
//fulfilled | |
console.log(resolved)}, | |
//rejected | |
rejected => { | |
//Will only be called if it is rejected | |
console.log(rejected) | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment