First, undefined:
1, when the declaration variable is not assigned value, then the value of the variable is undefined;
2, when the method does not return a value, the received return value is undefined.
Two, null:
A null value means pointing to an "empty object", which requires us to display a null value assigned to n.
"Note": In general, when an object is used, it needs to be shown that the browser can be garbage collected, it is necessary to explicitly assign the variable to null, so that the object pointed to by this variable can be recycled.
"Special reminder": whether the value of a variable is a null value or undefined indicates that the variable is not available. So before using some variables, you can check the variables to see if the variable is available.
"Method": Var x;
if (typeof (x)! = ' undefined ' &&x!=null) {
Alert (' x available ');
}else{
Alert (' x not available ');
}
javascript--"Null" and "undefined"