Programming · Flashcard
What does a closure keep access to after its outer function has returned?
Why this is the answer
A closure bundles a function with references to its surrounding lexical environment, so it keeps live access to those variables even once the outer function has returned. It doesn't take a frozen copy (later mutations are visible), the variables aren't freed while a closure still references them, and no redeclaration is needed to reach them.
Read more in the docs