一. 不论是Function, Object, Array这些都是构造函数。函数
Function
ƒ Function() { [native code] }
Function.prototype
ƒ () { [native code] }
Function.__proto__
ƒ () { [native code] }prototype
Object
ƒ Object() { [native code] }
Object.prototype
{constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …}
Object.__proto__
ƒ () { [native code] }code
console.log(Object.__proto__.__proto__)
VM884:1 {constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ对象
Function.prototype.__proto__ === Object.prototype // trueget
Function.prototype.__proto__ === Object.__proto__.__proto__ // true;原型
Function.prototype.__proto__
{constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …}io
Object.__proto__.__proto__
{constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …}constructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()get __proto__: ƒ __proto__()set __proto__: ƒ __proto__()console
Object.__proto__.__proto__.__proto__
nullfunction
使用instanceof 时 左边的对象里的__proto__对象包含右边这个函数原型的话就是true;构造函数
Object instanceof Function 这里function.prototype (函数原型) 的值为 f() { native code } ,而Object.__proto__(对象原型)的值如今也为 f () { natvie code } ;
也就是说f () { native code } 这个方法对象是建立 Object,Function, Array, 包括 RegExp, String Boolean 这些原始对象之父。 用new生成的对象。
并且 f () { natvie code } .__proto__ 指向了 { } 这个。 而Object.prototype (对象构造函数的原型) 直接指向了 { } 这个。
全部会有 Function instanceof Object // true ------> 拆解。 Function.__proto__.__proto__ === Object.prototype