Skip to content

Instantly share code, notes, and snippets.

@datrine
Created September 22, 2019 12:58
Show Gist options
  • Select an option

  • Save datrine/d070d7a8bbd2effc4bad74d43ac04875 to your computer and use it in GitHub Desktop.

Select an option

Save datrine/d070d7a8bbd2effc4bad74d43ac04875 to your computer and use it in GitHub Desktop.
(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