Last active
September 22, 2019 13:02
-
-
Save datrine/4d93a161618036e473abf8ade290bb24 to your computer and use it in GitHub Desktop.
async_callback
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
(cb=>{ | |
//setTimeout() wraps the callback cb and makes it run in | |
//another execution context, or "thread" | |
//the term thread is not accurate but may provide some ease of understanding | |
//the different contexts that help to achieve asynchrony | |
setTimeout(()=>{ | |
cb() | |
},0); | |
console.log("B") | |
})(()=>{ | |
console.log("C") | |
}); | |
console.log("A"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment