In the last lecture, we learned how the JavaScript engine manages the execution context inside call stack. In this lecture, you will learn how the execution context is created by JavaScript engine and what does it store.
When a function is called, a new execution context is created and put on top of the currently executing execution context. JavaScript engine creates the execution context in the two phases:
1. Creation Phase
2. Execution Phase
Creation phase is the phase in which the JavaScript engine has called a function, but its execution has not yet started. In the creation phase, JavaScript engine is in the compilation phase and it just scans over the function code in order to compile it. The code is not executed in creation phase.
We can associate an execution context with an object. This object has three main properties.
1. Variable object
2. Scope chain
3. The ‘this’ variable
These three properties of execution context are created during creation phase.
In this lecture, we will mainly focus on creation of Variable object property of execution object.