https://www.cnblogs.com/iceflorence/p/8920025.html
原型链的作用就是共享方法或属性,那么如何让我方法和属性共享给所有的对象去使用呢?我们都知道所有的对象都来自Object 构造器。那么我们在Object的原型上加入属性或者方法是否可以做到共享呢?答案是可以? 实例:
var person = function (name,sex) {
this.name = name
this.sex = sex
}
var person2 = function (name,sex) {
this.name = name
this.sex = sex
}
var Person2 = new person2('李四','男')
var Person = new person('张三','男')
Object.prototype.age=18
console.log(person.prototype.__proto__.age)
console.log(person2.prototype.__proto__.age)
https://www.jb51.net/article/179561.htm