Created
April 6, 2018 00:25
-
-
Save yusinto/28295371fc7613f66fab39f0c7435c54 to your computer and use it in GitHub Desktop.
reactjunkie.com promises promises
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
const p = new Promise( | |
// this is called the "executor" | |
(resolve, reject) => { | |
console.log(1); | |
resolve(2); | |
console.log(3); | |
} | |
); | |
console.log(4); | |
p.then( | |
// this is called the success handler | |
result => console.log(result) | |
); | |
setTimeout(() => console.log(5), 0); | |
console.log(6); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment