Execution Context in JavaScript
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.