Closures Explained
How an inner function retains access to variables from its enclosing scope even after that outer function has finished executing.
A closure is what you get when a function 'remembers' the variables from the scope it was created in, even after that outer scope has technically finished running. It is arguably the single most important concept in JavaScript for interviews, because closures underpin data privacy patterns, callback-based APIs, currying, memoization, and much of functional-style JS code.
A closure is like a backpack a function carries around: whatever variables were in scope when the function was created get zipped into that backpack, and the function can reach in and use them anywhere it goes, long after it's left the room (scope) where it was packed.