JavaScript and javascript tutorials
Zookeeper
1: three methods for defining functions in JavaScript
1) Same as defining methods in Java.
Function Name (parameter 1, parameter 2 ){
// Function body
}
2) use function Constructor (not commonly used)
Var Function name = new Function ("parameter 1", "parameter 2", "Function body ");
Note: 1: The constructor method defines javascript Functions. Note that F is capitalized in the Function;
2: accept any number of string parameters. The last parameter is the function body. If only one string is passed, it is the function body.
3) form of direct function quantity (most commonly used)
Var function name = function (parameter 1, parameter 2 ){
// Function body
}
2: logic judgment in JavaScript
In logical operations, 0, "", false, null, undefined, and NaN indicate false.
3: arrays in JavaScript are variable-length
Updating ..