← BYTES
JavaScript·Starter·Ref: 3.1.3
What is a closure in JavaScript?
Have a question about this video? Mention reference 3.1.3 when you contact us.
a.A syntax error
b.A function that remembers and can access variables from its enclosing scope even after that outer function has returned
c.A method that closes a database connection
d.A way to prevent a function from being called
A closure is formed whenever a function is defined inside another function and retains access to the outer function's variables via its lexical scope, even after the outer function has finished executing -- a core JS mechanism behind private state, callbacks, and many functional patterns.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES313#JavaScript