Undefined means "missing value", that is, there should be a value here, but it has not been assigned a value. Typical uses are:
(1) The variable is declared, but when it is not assigned, it is equal to undefined.
(2) when calling a function, the argument that should be supplied is not provided, which equals undefined.
(3) The object does not have an assigned property, and the value of this property is undefined.
(4) When the function does not return a value, undefined is returned by default.
var Ovalue; // output "true"
Null is used to represent an object that does not already exist, and is commonly used to indicate that a function is attempting to return a nonexistent object. Typical uses are:
(1) As a function parameter, the parameter of the function is not an object.
(2) As the end point of the object prototype chain.
Alert (null = = document.getElementById (' notexistelement '));
Alert (typeof undefined); // output "undefined" Alert (typeofnull); // output "Object"
Alert (null = = undefined); // output "true"
ECMAScript that undefined are derived from null, so they are defined as equal.
Alert (null//Output "false" alert (typeofnulltypeof Output "false"
Null is not the same as the type of undefined, so the output is "false". and ' = = = ' stands for absolute equals, where null = = = undefined output false.
The difference between JavaScript null and undefined