学习原型链和原型对象,不需要说太多话,只需要给你看看几张图,你自然就懂了。
prototype
表示原型对象__proto__
表示原型
实例、构造函数和原型对象

以 error 举例
图中的 error 表示 axios 抛出的一个错误对象(实例)。
宇宙的尽头是 null
js
Object.prototype.__proto__ === null
({}).__proto__.__proto__ === null

Function 与 Object
js
Function.prototype.__proto__ === Object.prototype
(function(){}).__proto__.__proto__ === Object.prototype
(() => {}).__proto__.__proto__ === Object.prototype

以 Date 为例,收尾!
js
(new Date()).__proto__ === Date.prototype
Date.prototype.__proto__ === Object.prototype

图片来源
来自我的 Github 仓库。图片使用 diagrams 生成的,你可以直接在我的基础上进行编辑。