1. var abc = function () {} differs from function abc () {}
The former is a function expression that requires code execution to be defined on this line, and this function expression creates an anonymous function and assigns it to a variable
The latter is a function declaration that is loaded into the scope by the JS interpreter before the code executes, and can be called before the code that defines the function
2, (function () {/ * code * /}) (); The meaning of this notation
The first pair of parentheses of the enclosing function (function () {}) returns an unnamed function to the script, followed by a pair of empty parentheses that immediately execute the returned unnamed function, which is the parameter of the anonymous function in parentheses.
Role: You can use it to create a namespace, as long as you write all of your own code in this special function wrapper, then the external can not access, unless you allow (the variable is preceded by the window, so that the function or variable becomes global). The code for each JavaScript library is basically this form of organization.
JS Knowledge Point