function declaration and function Expression difference
A function declaration declares a function by the function name () {}
A function expression is declared by declaring a variable and then assigning a function.
The difference is that before the execution of the program, the function declares the function to obtain the declaration of the variable, where the declaration of the variable is just a space, and then give a name, then to the variable name assignment value, there is a value, that is, before the assignment of the variable is not obtained, Using this variable will get undefined.
Regardless of whether you put the function in the program at the beginning or the end, the function of the execution of the statement can be normal execution.
FN ();//output FN
Console.log (FN2);//undefined declared, no value, automatic assignment undefined
function fn () {console.log (' fn ')}//functions Declaration
var fn2 = function () {console.log (' fn2 ')};//functional expression
FN2 ();//Output FN2
Declaration predecessors of variables and declarations of functions
There is an answer to the question above.
What is arguments?
Arguments is an object inside a function that corresponds to a passed in parameter, is a class array object, and does not have a method to manipulate the array.
Each pass-in parameter corresponds to ARGUMENTS[0],ARGUMENTS[1], which has a sequence of points.
such as function fn (name,age) {
Console.log (arguments[0];);
Console.log (arguments[1];);
}
Overloading of functions in JavaScript?
There is no function overload in JavaScript, because the same function name, if you define a different number of parameters, will overwrite the first occurrence.
Therefore, through the internal access to the arguments can not be passed in the number of parameters, although access can be, but the parameters passed in successively.
What is an immediate execution function expression, and what is the effect?
What is the scope chain for a function?
JavaScript Basics-function declarations, scope chains of functions