Docs

Namaste JavaScript — Interview Quick Notes

Ep 1–2: Execution Context & Call Stack


  • Everything in JS runs inside an Execution Context — a container with two components: Memory (variable environment) and Code (thread of execution).
  • JS is synchronous and single-threaded — one command at a time, in order.
  • Every EC is created in two phases: Memory Creation Phase (variables → undefined, functions → full body) then Code Execution Phase (runs line by line).
  • A new local EC is created each time a function is invoked and destroyed on return.
  • The Call Stack manages EC creation and deletion. Also called: Program Stack, Runtime Stack, Execution Context Stack.