Created
September 8, 2016 11:48
-
-
Save ZhihaoLau/48872e68c958cc72339681f88753b4ad to your computer and use it in GitHub Desktop.
Creating Settled Promise
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 promise = Promise.resolve('hello'); | |
promise.then(function(data) { | |
console.log(data); | |
}); | |
// Or: ------------------------ | |
let promise = Promise.reject('oops'); | |
promise.catch(function(err) { | |
console.log(err); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment