function declaration, function expression, anonymous function: function declaration: Functions fnname () {...}; Declare a function using the function keyword, and then specify a name for the functions, called the function declaration. function expression var fnname = function () {...}; Declaring a function with the function keyword, but not naming it, and finally assigning an anonymous function to a variable called a function expression, is the most common form of function expression syntax. Anonymous functions: Function () {}; Declaring a function using the functions keyword, but not naming the function, so called anonymous functions, anonymous functions are function expressions, anonymous functions have many functions, assigning a variable to create a function, assigning an event to an event handler or creating a closure, and so on. function declarations and function expressions differ in that the JavaScript engine parses the JavaScript code with a function declaration (function declaration hoisting) on the current execution environment (scope), The function expression must wait until the JAVASCIRTP engine executes to its row to parse the function expression from the top and the next line, and the function expression can be called immediately after it is appended with parentheses, and the function declaration cannot be called only in the form of FnName ().
Talking about JavaScript calling function expression immediately