There are three methods for defining Javascript methods.
One method is to define functions in Java, such as function (){}. Function is the keyword, and a is the function name.
The second method uses a Direct Volume definition, for example, var a = function (){}. Function, VaR is the keyword, and a is the function name.
The third method is to upload the parameter list and function bodies to the function as parameters, such:
VaR A = new function ("X", "Return x + X ");
Alert (A (2 ))
If you want to set a default value for the parameter in the method, you need to write the code: Function C (a, B) {If (typeof (A) = "undefinded") A = 1 ;}
Or:A =? A: 1
In the function, you can use the keyword arguments to obtain all the passed parameters.
Function f (){
Alert (arguments. length)
}
F (1, 2, 3, 4, 5)
Built-in functions of JavaScript, global fast:
Parseint: resolved to a number
Isnan: determines whether it is a number.
Parsefloat: resolved to floating point type
Escape: Encrypted string
Usescapse: decrypts encrypted strings
Eval: can execute the correct code in string format
Eval ("alert ('abc ')")