1. Definition of functions
2. Recursive invocation of functions
3. Closures
1. Functions are defined in two ways:
First type: function declaration
function functionname (arg0,arg1,arg2) { //body }
function declaration, an important feature is the function declaration promotion, that is, the function declaration is read before executing the code.
The second type: using function expressions
var functionname = function (arg0,arg1,arg2) { //body };
function expressions, like other expressions, must be assigned before they are used.
The difference between the two ways of creating a function declaration is that the function is declared in a way that causes the function declaration to be promoted.
2. Arguments.callee implementation of recursive calls to functions
Arguments.callee is a pointer to a function that is executing, so it can be used to implement recursive calls to functions.
Pros: When writing recursive call functions, using Arguments.callee is always more insured than using the function name.
3. Closures
Closure: Refers to a function that has access to a variable in another function scope.
A common way to create closures is to create another function inside a function.
JavaScript Learning Notes (function---learn again)