Skip to main content

1) JS Working and Execution

Everything in JavaScript happens inside the execution context. Imagine a sealed-off container inside which JavaScript runs. It is an abstract concept that holds info about the env. within the current code is being executed.

  • In the container, the first component is the memory component and the 2nd one is the code component
  • The memory component has all the variables and functions in key-value pairs. It is also called a Variable environment.
  • Code component is the place where code is executed one line at a time. It is also called the Thread of Execution.
  • JS is a synchronoussingle-threaded language
    • Synchronous:- One command at a time.
    • Single-threaded:- In a specific synchronous order.