123456
typeof 1 //typeof '1' //typeof true // typeof x // undefined if(typeof x == 'undefined') // trueif(x) //直接报错
123
typeof function(){}typeof class C {}typeof Math.sin
typeof null // 当时设计的原因typeof [] //typeof {} //
1234567891011121314151617181920
// A 的 __proto__ 指向 B 的 prototype 时,就认为 A 就是 B 的实例[] instanceof Array; //true({}) instanceof Object;//truenew Date() instanceof Date;//true//无法判断继承function Parent(){};function Child(){};function Other(){};Child.prototype = new Parent();let child = new Child();child instanceof Child; // truechild instanceof Parent; // truechild instanceof Object; // truechild instanceof Other; //false//Child.prototype.__proto__ = Parent.prototype//Parent.prototype.__proto__ = Object.prototype//Object.prototype.__proto__ = null