🔰scope chain
JS ⟩ concepts ⟩ scope ⟩ scope chain
The scope of a code block can reach all its parent's lexical environment so it can use its parent’s variable(s). In this way, we have a scope chain, chain of all parent’s scope.
LHS reference - find the variable container itself (in the scope chain).
Q:lexical environment === scope❓
A:my understanding is that
lexical environment is created at runtime, every time a scope is entered❗
Last updated