- A A function that is defined inside another function
- B A function that has access to the outer function's variables
- C A function that is bound to an object
- D None of these
- Share this MCQ
Answer:
B
Share this MCQ
A closure is a function that has access to the outer function's variables even after the outer function has returned.
Closures are created when a function is defined inside another function and the inner function has access to the outer function's variables.
Closures are often used to create private variables and to preserve state in callback functions.
Share this MCQ