What is a closure in JavaScript?
-
A
A method that closes a browser window
-
B
A function that retains access to its outer scope even after the outer function returns
-
C
A way to terminate an asynchronous operation
-
D
An error thrown when a variable is out of scope