What Exactly Is an Execution Context?
An execution context is an internal data structure created by the JavaScript engine to track the execution of code.
The Two Phases
Phase 1: Creation Phase (Memory Allocation Phase)
This is where JS prepares everything before running your code.
In this phase, the JavaScript engine creates the execution context and sets up the script's environment.
Phase 2: Execution Phase
Now the code runs line by line:
- Variables get actual values
- Functions execute
- Expression are evaluated

Join the discussion
Sign in with your account to post comments, reply to others, and participate in the conversation.
Login to Comment