In JavaScript, what is a closure ?
2026
In JavaScript, what is a closure ?
Answer: B. A function bundled with its lexical environment — A closure is a function bundled with its lexical environment, allowing access to outer variables even after the outer function has returned.
- 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 259 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.
Loading lesson…