Definition of function
1. Function declaration
function function name () {
}
2. Function expression
var aa=function(){
}
function call
1. Function name ()
Function classification: Method 1:
Named functions
Anonymous function (Anonymous function cannot be called directly. If you want to call it, you need to use self-calling of the anonymous function)
( function(){
alert();
})();
Method 2:
Built-in functions: Officially provided
Custom function
Function parameters (formal parameters actual parameters)
Parameters are in one-to-one correspondence
Actual parameters > Formal parameters -- redundant actual parameters are omitted
Actual parameters The above is the detailed content of Basic explanation of JavaScript functions. For more information, please follow other related articles on the PHP Chinese website!