As for closures, I understand that as a sub-function defined inside a function body function, the child function has a unique interface and exits. A variable that is a function body is referenced and the closure is activated when the function body returns.
About understanding we can combine the following code with the form of closures we see:
(function () { //dosomething }) ()
1. This sub-function can access variables, parameters, and other intrinsic functions (sub-functions) in the scope of the external function (function body) function.
2. When one of these intrinsics is called outside the outer function that contains them, a closure is formed.
Tips: The second parenthesis in a closed-form structure that indicates that a function is called to form a closure
3. So closures are also a bridge between the outside of the function and the inside of the function.
JavaScript's personal understanding of closures