learning mark
The principle of instanceof to detect whether an object A is an instance of another object B is to check whether the object pointed to by the prototype of object B is on the [[prototype]] chain of object A. Returns true if it is, false if it is not. However, there is a special case, when the prototype of object B is null, an error will be reported (similar to a null pointer exception).
https://www.ibm.com/developerworks/cn/web/1306_jiangjj_jsinstanceof/