What is a closure in JavaScript?

JavaScript Associate Easy

JavaScript Associate — Easy

What is a closure in JavaScript?

Key points

  • Closures allow functions to access variables from their parent functions
  • They help in maintaining state within a function
  • Closures are a powerful feature of JavaScript for creating private variables

Ready to go further?

Related questions