Null
In JavaScript, null means "nothing".
Null is a special type with only one value. Represents an empty object reference.
var person = {firstName: "John", LastName: "Doe", Age:50, Eyecolor: "Blue"}; var NULL ;d Ocument.getelementbyid (typeof person;
Undefined
In JavaScript, undefined is a variable that has no value set.
typeof A variable that has no value returns undefined.
The difference between undefined and null
document.getElementById ("Demo"). InnerHTML =typeof undefined + "<br>" +typeofnull + " <br> "+(null = = = undefined) +" <br> "+(null = = undefined);
Printing results:
Undefined
Object
False
True
I don't understand why null==undefined is true,
On Baidu to see someone said
In fact, the undefined value is derived from a null value, and the ECMAScript standard specifies that the test for equality should return true, that is,
alert (null==undefined); True
Basic JavaScript Learning--typeof,null,undefined