In JavaScript, what is a closure ?
2026
In JavaScript, what is a closure ?
- A.
A function that returns nothing
- B.
A function bundled with its lexical environment
- C.
A loop termination condition
- D.
An error handling mechanism
Attempted by 71 students.
Show answer & explanation
Correct answer: B
A closure is a function bundled with its lexical environment, allowing access to outer variables even after the outer function has returned.