In JavaScript, a closure is created when an inner function accesses the ________ of an outer function after the outer function has executed.

  • parameters
  • variables
  • methods
  • properties
In JavaScript, a closure is created when an inner function accesses the variables of an outer function after the outer function has executed. Closures allow inner functions to "remember" and access the variables of their containing (outer) function even after the outer function has finished executing. This is a fundamental concept for managing scope and data privacy in JavaScript.
Add your answer
Loading...

Leave a comment

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