A closure is a function that remembers and accesses variables from its outer scope even after the outer function has finished executing.
Retains access to outer function variables.
Preserves the lexical scope.
Allows data encapsulation and privacy.
Commonly used in callbacks and asynchronous code.
For example


Top comments (0)