Common functions
1, without parameters
function fucname () { alert ("Hello");} FuncName ()
2, with parameters
function FuncName (ARG) { alert ("Hello");} FuncName ("Brin")
normal function, self-executing function
1, without parameters
(function() { alert (123);}) ()
2, with parameters
(function(ARG) { alert (123);}) ("Brin")
Note: Self-executing function, no function name structure such as: (function () {code}) ()
Anonymous functions, which can be passed as arguments
Anonymous functions are written in the following format:
Fuction () {
Alert ("Hello");
}
The application of anonymous functions is as follows
Fuction Facname (ARG) { arg ();} ///anonymous function, as a parameter passed to the Facname function funcname (fuction () {alert ("Hello")})
JavaScript function definition and type of JS basis-ordinary number-self-executing function-anonymous function