Skip to main content

Scope of a variableRegion of code where Variable can be accessed

All scopes have access to variables from all outer scopes which it looks up through the Scope Chain

Scope Chain

Upwards Unidirectional access to Variables from current scope to outer scopes via Variable Lookup

Variable Lookup

(process) to look upwards for Variables in Scope Chain, when not in Lexical Environment

Variables are not copied from parent to child

image

!note scope chain is unrelated to the call stack and order of function calls

References

  1. TDZ ↔ Region of Code outside Scope of a variable, variable uninitialized from Scope start to Declaration