Null is a JavaScript literal that represents a null value, that is, no object is rendered. He is one of the original JavaScript values. A null value is often placed on an object that is expected, but does not refer to the parameter location of any object, that is, the initialization of the object.
Let's look at one of the following examples
Javascript
var obj = null;console.log (typeof obj = = = = "Object"); True
We understand that by naming a null, NULL is expected on an object and may be set in JavaScript specifications. So return a true. In fact, NULL itself is a literal, return null, why also return object? This should be a bug in the specification.
However, it is important to note that NULL is different from undefined. Undefined is a property of a global variable.
When null or undefined is detected, note the difference between equal (= =) and congruent (= = =) Two operators (the former performs type conversion), so we use the congruent operator (= = =) In the set JavaScript authoring specification, as a comparison, Try doing the following code understanding.
Javascript
NULL = = undefined//Falsenull = = undefined//True
So we have to understand these two points. These are likely to make mistakes when the code makes judgments, and it is also a common problem in the job interview.
This article belongs to Wu Shi Wei's blog, the public number: BIANCHENGDEREN,QQ Group: 186659233 of the original article, reproduced please indicate the source and the corresponding link: http://www.wutongwei.com/front/infor_ showone.tweb?id=162, welcome everyone to spread and share.
Null value in JavaScript, two points of special attention