0x01

先上一张图,如果这张图你都能看懂的话,我觉得就没必要再往下看了

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ec9a6778-f235-4ec2-b91f-afcb1b481fee/rId21.png

由图可得: 1、所有的对象都有__proto__属性,该属性对应该对象的原型. 2、所有的函数(

也只有函数才有

)对象都有prototype属性,该属性的值会被赋值给该函数创建的对象的_proto_属性. 3、所有的原型对象都有constructor属性,该属性对应创建所有指向该原型的实例的构造函数. 4、函数对象和原型对象通过prototype和constructor属性进行相互关联.

0x02

函数字面量

所有构造函数的__proto__都指向Function.prototype,它是一个空函数(Empty function)

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2a48a226-c750-43fc-9bee-061227bfbb43/rId24.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b2545d4c-323d-4293-8d8c-ac55c6932f7b/rId25.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/db5956dc-6887-4f2e-bc2e-77ed8ff0fac6/rId26.png

对象字面量

对象字面量的__proto__直接指向大Boss–>Object

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/edd2b85b-338d-4ad0-ac37-cf16f950d90d/rId28.png

0x03

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/67b0538e-711d-49ae-933d-04c83ec7abdd/rId30.png

image.png

解读图