Javascript- Execution Context
In JavaScript, an execution context is a crucial concept that defines the environment in which your code is executed.
Javascript is a single-threaded, synchronous language. Every Javascript code runs inside the execution context which is a container.
Execution Context is composed of two components.
- Memory Component also known as Variable Enviornment.
- The code component is also known as the Thread of context.
Memory components consist of Key value pair and functions are stored.
The variable environment is where all the variables and Functions are stored.
The code component consists of lines of code. It executes one line of code at a time. It is also called a thread of execution means each line of code is executed one by one.
Javascript executes one command at a time and synchronous means one line executed at a time that is the way javascript is synchronous and single-threaded is the concept.