Let's take an example of the below code snippet.
EC : Execution Context
Global Execution Contextis going to be created.
call x(), and again a new EC is created for x.
ECfor x is created it will run the code line by line inside x.
Inside x, a new function call
y()is invoked, it again creates an EC for y.
When y is finished running, it will back to EC of
x, and variable t is assigned.
After x run is finished, it will be back to
Global EC, and variable r is assigned.
Global ECfinishes running and the program stops.
Stay tuned - Follow me on Twitter