Closure
Last updated
Was this helpful?
Last updated
Was this helpful?
It means that the inner function holds a reference to the outer function environment which the outer function execution context is executed and destroyed
If the function return another function (second function), second function will be in closure scope, even the parent function executed and its variable is supposed to be disappeared, but its son will take the variable of its parent as a reference if the variable is not defined.
Example: