Updated on 10 Apr, 20262 mins read 18 views

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
Buy Me A Coffee

Leave a comment

Your email address will not be published. Required fields are marked *