Closure of four concepts, execution environment, activity object, scope, scope chain
When a function is defined, the scope of the function is determined, the entire function body is the execution environment, if the function is a global function, then its scope chain as long as the Window object, when the function is called, an active object is created, the arguments property is added to the active object, When a child function (nested function) accesses a variable, it is searched from its own active object, no more active object of the parent function is found, and then the Window object is not returned undefined.
Closure of the application scenario, 1, in memory to save a variable, when a function has sub-function (created closure), the function of the value of the variable will not start again, but the last operation after the value of the save.
2. JS private Property and private method (cannot be accessed externally) through the security of the protection variable
JS Closed Package