【JS】 __proto__ && prototype

image.png

image.png

实例的__proto__指向构造函数的prototype。

image.png

image.png

普通对象默认没有prototype,new 操作符创建的对象有。

image.png

对象也是由构造函数创建的,普通对象默认没有prototype属性,只有__proto__指向构造函数的prototype。

Function创建的对象有prototype指向其(Function)的prototype。

并且Function.proto === Function.prototype

可以自己设置父类prototype对象与子类__proto__指向来实现继承。