Daily Term: Closure
Closure
A Closure is a function that retains access to variables from its outer scope, even after the outer function has finished executing. For example, in JavaScript, a counter function might return an inner function that increments a variable defined in the outer scope. Closures enable powerful patterns like data encapsulation and currying, but they can lead to memory leaks if references to outer variables are not managed properly.
Date: 2025-12-08