What is NOT a consequence of dynamic scoping, considering JavaScript uses lexical scoping?

  • Variables can change unexpectedly
  • Function definitions capture their context
  • Easier to reason about
  • Potential bugs due to unexpected changes
In JavaScript, dynamic scoping is not a consequence since JavaScript primarily uses lexical scoping. With lexical scoping, variable scope is determined by the placement of variables in the source code, making it easier to reason about the code's behavior. Dynamic scoping, where scope is determined by the calling context at runtime, can lead to unexpected changes in variable values and potential bugs, but it is not a consequence of JavaScript's lexical scoping.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *