closed-over variable
nounUK /kləʊzd ˈəʊvə ˈveəriəbl/
US /kloʊzd ˈoʊvər ˈveriəbl/
A variable that a function remembers from the place where it was made.
The counter function keeps its count in a closed-over variable, so the number stays alive between calls.
RELATED WORDS
OTHER MEANINGS
2. A variable from an outer function that an inner function can still read or change.
In the inner function, name is a closed-over variable taken from the outer function.
3. A local variable kept alive after its defining function returns because another function still uses it.
Even after makeAdder finished, its closed-over variable total was still reachable.
4. A free variable that a closure binds to a value from its creation context.
The callback uses a closed-over variable to remember the user's chosen theme.