原型对象prototype
函数➡️对象:Prototype
对象➡️对象:.__proto__
对象➡️函数:prototype.constructor
但是对象不能返回来指向。
对象一直找到null为止就是没有了,不用再往上找了。
子构造函数如何继承父构造函数的方法:把方法绑定在父构造函数的原型对象上
流程:
//创建一个构造函数
function Star(){}
//实例化对象
1.const ldh=new Star()
2.console.log(ldh.__proto__=Star.prototype)//t
3.console.log(Star.prototype.constructor===Star)
4.console.log(ldh.__proto__.__proto__===Object.prototype)
5.console.log(Object.prototype.constructor===Object)