Example: 1
CopyCodeThe Code is as follows: function (){
Alert ("I am my feet ");
}
2Copy codeCode: var A = function (){
Alert ("I am my feet ");
}
The methods of 1 and 2 are equivalent. 1 is a famous function, while 2 is just to point a variable to an unknown function, and 1 and 2 are equivalent here. 2. You can directly add brackets after the function declaration to call the function immediately after the creation. For example:
VaR I = function (OBJ ){
Alert (OBJ );
} ("I am my feet ");
In addition, there is an important difference between a famous function and an unknown function: For a famous function, it can be defined after it is called. For an unknown function, it must be defined before it is called. For example, the following example shows an error when using an anonymous function:
I ();
VaR I = function (){
Alert ("I am my feet ");
}
The following statements are correct:
VaR I = function (){
Alert ("I am my feet ");
}
I ();
Or use the famous function:
I ();
Function I (){
Alert ("I am my feet ");
}