What does an execution context contain?
Three things: the variable environment (declared vars and functions), the scope chain (for resolving variables), and the value of this (determined by how the function was called).
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in What Is an Execution Context in JavaScript?
It is the environment where JS code is evaluated and executed. It has two phases: memory allocation (variables get undefined, functions are stored) and code execution (values are assigned, functions run).
The Memory Allocation Phase, where memory is reserved and hoisting happens, and the Code Execution Phase, where the code runs line-by-line.
A global execution context is created once when the program starts. A function execution context is created every time a function is invoked, pushed onto the call stack, and destroyed when the function returns.
Still have questions?
Browse all our FAQs or reach out to our support team
