In JavaScript, when a function is defined inside another function, the inner function has access to the ________ of the outer function due to lexical scoping.

  • Variables
  • Properties
  • Methods
  • Parameters
In JavaScript, when a function is defined inside another function, the inner function has access to the variables of the outer function due to lexical scoping. Lexical scoping means that the inner function "remembers" the scope in which it was created, allowing it to access and manipulate variables defined in the outer function. This behavior is one of the fundamental aspects of closures in JavaScript.
Add your answer
Loading...

Leave a comment

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