Like learning any new language, your knowledge can drip away when your focus shifts.
What I really needed, silly me, was a sweet lil' mixture of coding and concepts.
Originally a mathematical concept, from lambda calculus (did you know that?! me neither!). But for our purposes here, we know a closure to be a behavior of functions.
And only functions.
An object cannot have closure.
Nor does a class have closure.
For closure to be observed, a function must be invoked.
And, it must be invoked in a different branch of the scope chain from where it was originally defined.
Each reference from an inner function to the variables in an outer scope is called a closure.
A closure gives you access to an outer function’s scope from an inner function.
The closure is a function that remembers the variables from the place where it is defined, regardless of where it is executed later.
Many (and I mean many) other authors claimed to explain closures simply, but I believe Dmitri Pavluti did it best:
Have a different resource or explanation that helped closures "click" for you? Share below - would love to hear more.