Hint
A function that remembers its outer scope after the outer function returns
A closure is a function that retains access to its lexical scope even after the outer function has returned.
function makeCounter() {
let count = 0;
return {
increment: () => ++count,
decrement: () => --count,
value: () => count
};
}
const counter = makeCounter();
counter.increment(); // 1
counter.increment(); // 2
Real-world uses: data encapsulation, factory functions, event handlers with state, memoization, partial application.