In this series of posts we will explore:
- What is Execution Context?
- What is Call Stack?
- What is Event Loop?
- The "this" keyword?
And much more...
I wil keep updating this post with further parts. Now let's dive in.
Both phases are known by multiple names.
- Declaration Phase || Memory Allocation Phase || Creation Phase
- Execution Phase || Implementation Phase
Variables are initialized with Undefined as value.
That's it. This phase don't care about executing the code. It just initializes all the variables with undefined.
In this phase Undefined value of variables are replaced by the actual value.
For all the function calls (invocation) a new Function Execution Context (FEC) is created inside the Global Execution Context (GEC is the main parent execution context).
And this FEC will again follow the entire 2 phase process of execution context.
Every execution context (global OR function) maintains a memory. For GEC it is the Global Memory and for FEC it is the local memory.
I hope these will help.
In part 2 of this series we will discuss about how JS manages all these nested Function Execution Context. The Call Stack.
If you enjoyed it or found useful, please consider joining my weekly Newsletter: https://www.getrevue.co/profile/codeswastik