What is the outcome of using closures regarding variable scope and lifetime in JavaScript?

  • Variables declared in a closure have global scope.
  • Variables declared in a closure are accessible only within the closure itself.
  • Variables declared in a closure have the same scope as variables declared in the outer function.
  • Variables declared in a closure have function scope.
Closures in JavaScript have function scope, meaning variables declared within a closure are accessible only within that closure. They do not have global scope and are not directly accessible from outside the closure.
Add your answer
Loading...

Leave a comment

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