How is a function execution context different from global?
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.
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.
Hoisting happens in the memory allocation phase. Variables declared with var get undefined, function declarations are stored in full. This makes them usable before their line of declaration.
Still have questions?
Browse all our FAQs or reach out to our support team
