Ah, closures, I only know a function of a function package (there are eggs with ah! Throw)
1. Start with a scope.
js not block-level scope, but there js function scope
js global variables and local variables
Define variables within the function of the external function is not accessible, which is a local variable.
Defined in advance in an external function variables can be accessed inside a function, this is a global variable.
2. If I wanted to get outside variables inside the function how to do it?
Then I came alive again in a function 1 function 2, function 1 is used to define the value of the function 2 exposed.
This is a closure.