1)Global Execution context .
2) Function Execution context.
In every context there are two phases. Loading phase, execution Phase. In loading phase 4 things happen :
- global object creation
- this object creation that actually points the global object.
- memory allocation for variable and function.
- the value of variable is assigned as undefined.
In the execution phase the undefined values in variable are replaced by the given values and the function remains as it is. Functions are only executed (by function execution context) when they are called.
Again in function execution context 4 things happen like global execution but in this case in stead of global object creation, parameter or arguments object creation happens and the rest are same like global execution context. The function execution context is only created when the function is called in the global execution context.
To sum up, simply the whole process is : In code execution first global execution context creation happen that has two phase one is loading and another is execution phase. In loading phase has four steps window object creation, this object creation, memory allocation of the variable and functions and finally the values of the variables are assigned as undefined. Then in the execution phase the variables are assigned the given values.In this execution phase if there is any function I mean if any function is called, functional execution context is created that follows the same process like global execution context but there is a one difference that is here parameter or argument object is created in stead of global object. By this way the whole execution happens and we see the output😃👏.