A closure is the combination of a function and the lexical scope in which the function was declared. In other words, closures or closures are functions that handle independent variables. In other words, the function defined in the closure “remembers” the scope in which it was created. mdn
Simply: the function defined in the closure “remembers” the scope in which it was created
In short, it allows us to encapsulate code but with access to its context.
All that context you remember attacks RAM memory
We should not abuse this hack for performance issues
It is very useful to emulate private methods among other things