Created
February 2, 2015 11:30
-
-
Save deepak/dd2e505b7ff71121fd9b to your computer and use it in GitHub Desktop.
javascript ES6 promise is not executed in serial order
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
var flag = false; | |
var promise = Promise.resolve(); | |
// not linear execution of code! | |
// is the then callback pushed onto the call-stack. how ? | |
promise.then( (x) => { | |
console.log(`flag is ${flag}`); // flag is true | |
}) | |
flag = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
noob code to shim a promise. does not work