Docs

Namaste JavaScript — Interview Quick Notes

Ep 7: Scope Chain & Lexical Environment


  • Every EC has a reference to its lexical parent's environment — this chain is the Scope Chain.
  • An inner function can access variables in all outer scopes; the global EC cannot access local variables.
  • Lexical Environment = local memory + reference to parent's lexical environment.
  • The search travels up the chain until null (global) is reached — this is lexical scoping.