Question · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects

Definition of Closure in JavaScript

What is a closure in JavaScript?

Answer options

  • A special object type for storing data
  • A try-catch block for error handling
  • A function that remembers variables from the scope in which it was created, even after that scope has ended
  • A method for closing a server connection
Show the answer

Correct answer:

  • A function that remembers variables from the scope in which it was created, even after that scope has ended