Execution Context
Execution Context
Section titled “Execution Context”Introduction
Section titled “Introduction”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.
Learning Objectives
Section titled “Learning Objectives”- 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
Visual Summary
Section titled “Visual Summary”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 --> DTopics Covered
Section titled “Topics Covered”| Topic | Description | Est. Time |
|---|---|---|
| Types of Context | Global, function, and eval contexts | 10 min |
| Creation Phase | Memory allocation, hoisting, scope setup | 15 min |
| Execution Phase | Code execution, variable assignment | 10 min |
| Lexical Environment | Environment records, scope chain | 15 min |
Prerequisites
Section titled “Prerequisites”- Basic JavaScript syntax
- Functions and scope
- Hoisting basics
Learning Path
Section titled “Learning Path”Types of Context → Creation Phase → Execution Phase → Lexical Environment