JavaScript's scope system is called "lexical scope"
Last updated 2 years ago
Was this helpful?
JS ⟩ concepts ⟩ scope ⟩ lexical scope
🈯 synonyms: "static scope"
JavaScript's scope is determined at compile time; the term for this kind of scope is "lexical scope". ("lexical" is associated with the lexing stage of compilation)
👉 compare: static vs. dynamic scoping
scope / scope chain
lexical environment
JavaScript is largely lexically scoped, meaning that functions can access variables defined in their surroundings. 👉 see: RingoJS
static scope: C, Java, JavaScript, Python and Ruby.
dynamic scope: Perl.
YDKJS: Scope & Closures (v.2) ⟩ Ch. 1
Wikipedia ⟩ lexical scope vs. dynamic scope
ringojs ⟩ Understanding module and global scope ⭐️
Anil ⟩ ⭐️