Skip to main content
InterviewHubPRO
Section Overview
Q440

Question 440 of 536

Part 7: Execution Context, Functional JS & V8 Engine (404 - 463)

82%
JavaScript & V8 Internals (536 Qs)•Part 7: Execution Context, Functional JS & V8 Engine (404 - 463)

What is function execution context?

senior LevelCode ExampleMemory Management

Whenever a function is invoked, the JavaScript engine creates a different type of Execution Context known as a Function Execution Context (FEC) within the Global Execution Context (GEC) to evaluate and execute the code within that function.

Practical Code Example

javascript
// Function Execution Context: Created whenever a function is invoked.
// Contains:
// 1. Lexical Environment (parameters, local variables)
// 2. Variable Environment
// 3. 'this' value binding determined at call time
function greet(user) {
  const msg = 'Welcome';
  return `${msg}, ${user}`;
}
greet('Alice'); // Pushes new Function Execution Context to Call Stack