In JavaScript, the execution context is the environment where code is executed. It contains all the information needed to run a piece of code, such as variables, functions, and the scope chain.

Execution context has two components:

  1. Memory component

  2. Code component

Memory component(memory allocation phase): The memory component is also called a variable environment. This is the place where all variables and functions are kept as key-value pairs.

Syntax : Key: value;

Example :

name: Shivaji

f() : { .... }

Code component(execution phase) :

After the execution of the whole program, the global execution context can be deleted.