Q
What is a closure in JavaScript?
-
A
A function bundled with references to the variables of the scope where it was created, even after that scope has finished
-
B
A function that closes the browser
-
C
A sealed object
-
D
A completed promise
Correct Answer:
A. A function bundled with references to the variables of the scope where it was created, even after that scope has finished
Explanation:
Closures power the module pattern, private state, and callbacks.