What is the difference between lexical scoping and dynamic scoping?
Answer
Lexical scoping refers to when the location of a function's definition determines which variables you have access to. On the other hand, dynamic scoping uses the location of the function's invocation to determine which variables are available.
Good to hear
Lexical scoping is also known as static scoping.
Lexical scoping in JavaScript allows for the concept of closures.
Most languages use lexical scoping because it tends to promote source code that is more easily understood.
Additional links
PreviousWhat are landmark roles and how can they be useful?NextWhat is the difference between null and undefined?
Last updated