We can assume the execution context to be the big box🗃 container in which the whole JavaScript is executed.
So the execution context has 2 components in it.
-
Memory Component
-
Code Component
-
It has a key: value pair to store the variable, and similarly, the functions are also stored here.
-
This memory component is also known as a variable environment.
-
Here the code is executed one line at a time. also know the thread of execution.
-
The thread of execution is a thread is just thread where the code is executed one line at a time.
![](https://cdn.hashnode.com/res/hashnode/image/upload/v1676920395269/39d82294-44a2-411b-9d43-9c1d070f192e.png align="center")
JavaScript is a Synchronous Single threaded Language
The reason it's called a thread of execution is that it's like a single thread where the code is executed line by line.
When we say Synchronous Single threaded that means JavaScript can execute single command at a time and that too in a specific order.
This means it can go to the other line only when its previous line is executed, and JavaScript is not possible without this beautiful execution context at all.