When a function is invoked, a Local Execution Context is created. The responsibility of this context is to parse the called function and return the result to our global environment.
It's okay if this doesn't make sense yet, there is an example of below that'll
clear things up.
To demonstrate the Queue, I've used
setTimeout() from our browsers Web API. I've set the timeout to zero on both instances, to show that it won't impact the order of our logs even though there isn't an actual delay.
- What the Heck is the Event Loop Anyway? by Philip Roberts
- JavasScript Call Stack What It Is and Why It's Necessary by Charles Freeborn
- Introduction to Functions, Execution Context and the Call Stack by Code Smith
- The JS Call Stack Explained in 9 Minutes by Colt Steele