Execution Context in JavaScript

Ayesha Malik
1 min readJan 8, 2021

--

Everything in JavaScript happens inside an Execution context.
Execution context is like a big box which has two component in it.
🔹 The first component is known as the Memory component.
🔹 The second component is known as the Code component.

Memory component: This is the place where all variables and functions are stored as key-value pairs. Memory component is also known as the Variable Environment.

Code component: This is the place where the whole code is executed one line at a time. This is also known as the Thread of execution.

JavaScript is a synchronous, single-threaded language which means javaScript can only execute one command at a time, when we say synchronous single-threaded that means javascript can only execute one command at a time and in a specific order, it can only go to the next line once the current line has been finished executing.

--

--

Ayesha Malik

I’m a full-time software engineer who loves sharing knowledge to help others become better developers.