Reference Link: http://blog.csdn.net/qq_26676207/article/details/53100912
Http://www.ruanyifeng.com/blog/2014/03/undefined-vs-null.html
Http://www.tuicool.com/articles/b6vqmy
About when Null appears when undefined:
So Answer:
The variable definition is undefined when it is not assigned, or it is a variable defined as an unassigned variable or typeof;
null, which represents an empty object, is the hour of the prototype chain, and when a space is freed, the variable is assigned null, and the garbage collection mechanism recycles it, typeof Null is an object;
typeof returns a string of six possible types: "number", "string", "boolean", "object", "function", "undefined";
Undefined values and definitions unassigned for Undefined,null is a special Object,nan is a special number.
var a1;
var A2 = true;
var a3 = 1;
var a4 = "Hello";
var A5 = new Object ();
var a6 = null;
var a7 = NaN;
var a8 = undefined;
Alert (typeof a); Show "undefined"
Alert (typeof a1); Show "undefined"
Alert (typeof a2); Show "boolean"
Alert (typeof a3); Show "number"
Alert (typeof a4); Show "string"
Alert (typeof a5); Show "object"
Alert (typeof a6); Show "object"
Alert (typeof a7); Show "number"
Alert (typeof a8); Show "undefined"
The = = operator considers the undefined value equivalent to Null.
Null represents a definite already known value, which is an empty object
Null means "no object", that is, there should be no value at All. 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.
Object.getPrototypeOf(Object.prototype)// null
从逻辑角度上来讲,null值表示一个空指针对象
null and undefined in JS