Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 742 Bytes

what_is_function_execution_context_.md

File metadata and controls

28 lines (18 loc) · 742 Bytes

What is function execution context?

A function execution context is created when a function is invoked. It contains:

  1. this Binding:

    • Depends on how the function is called.
  2. Scope Chain:

    • Includes variables from the function's scope and its outer lexical environments.
  3. Variable Environment:

    • Stores function variables and parameters.

Example:

function example() {
  var a = 10; // Stored in variable environment
  console.log(this); // Depends on invocation
}
example();

Tags: intermediate, JavaScript, Execution Context