Skip to content

Execution Context

An execution context is the environment where JavaScript code is evaluated and executed. Every time a function is called, a new execution context is created.

  • Understand the three types of execution context (global, function, eval)
  • Learn the two phases: creation and execution
  • Understand the lexical environment and variable environment
  • Know how execution contexts are pushed/popped from the call stack
flowchart TD
A["JavaScript Engine Starts"]
B["Global Execution Context Created"]
C["Phase 1: Creation (Memory)"]
D["Phase 2: Execution"]
E["Function Call Detected"]
F["New Function Execution Context"]
G["Repeat Creation & Execution"]
H["Function Returns → Context Popped"]
A --> B --> C --> D
D --> E --> F --> G --> H
H --> D
TopicDescriptionEst. Time
Types of ContextGlobal, function, and eval contexts10 min
Creation PhaseMemory allocation, hoisting, scope setup15 min
Execution PhaseCode execution, variable assignment10 min
Lexical EnvironmentEnvironment records, scope chain15 min
  • Basic JavaScript syntax
  • Functions and scope
  • Hoisting basics
Types of Context → Creation Phase → Execution Phase → Lexical Environment