This is from MDN:
Fun fact: If there are 4 values in the scope of a function and only 2 are being used by that function, that means when that function is getting executed or queued for execution, only those 2 values being referred are kept in memory and the other values are not kept.
Closure is not a thing, it is a phenomenon. A bi-product of lexical scoping and execution context.
- Currying functions
- Object oriented programming
- Callbacks like event handlers