Skip to content

Commit c18a37c

Browse files
authored
Merge pull request #271 from AashishSinghal/master
+ Q451 Answer
2 parents dcb3ba4 + 0a208a2 commit c18a37c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8426,6 +8426,13 @@ Here are some common use cases of closures:
84268426
**[⬆ Back to Top](#table-of-contents)**
84278427
84288428
451. ### What are the phases of execution context?
8429+
The execution context in JavaScript is a data structure that stores the information necessary for executing a piece of code. It includes the code itself, the values of the variables used in the code, and the scope chain. The scope chain is a list of objects that are used to resolve variable names.
8430+
8431+
The execution context has two phases:
8432+
* Creation phase: In this phase, the JavaScript engine creates the execution context and sets up the script's environment. This includes creating the variable object and the scope chain.
8433+
* Execution phase: In this phase, the JavaScript engine executes the code in the execution context. This includes evaluating expressions, assigning values to variables, and calling functions.
8434+
8435+
The execution context is created when a function is called. The function's code is then executed in the execution context. When the function returns, the execution context is destroyed.
84298436
84308437
**[⬆ Back to Top](#table-of-contents)**
84318438

0 commit comments

Comments
 (0)