console.log(typeof Object)//null var o = {} ,var obj = new Object, new Dog()
console.log(typeof Function)
console.log(typeof Number)
console.log(typeof Boolean)
console.log(typeof String)
//除了undefined js 其余5中类型的封装类型本质都是函数
console.log(typeof undefined)
console.log(typeof Date)
console.log(typeof Array)
console.log(Date.prototype)
console.log(Object.prototype)
console.log(Function.prototype)//function(){}
上面是迷惑你的,下面才是干货:
function Father(){
this.p = 'p'
}
var f = new Father
function Son(){
}
//Son 构造函数的原型对象 指向了f
//这样就继承了f 的p 属性
Son.prototype = f
//Son 的实例中有一个__proto__记录了 原型对象 Son.prototype 也就是 对象f
var s = new Son()
console.log(s)
//关键在于f 对象中也有一个 __proto__ 记录了它的原型对象 Father.prototype
//..... 如此一层一层的实现了继承
//终点是 null 这就是传说中的无中生有吧
Object.prototype.__proto__
来源:https://www.cnblogs.com/xuezizhenchengxuyuan/p/6814244.html