function Person(name,age){ this.name=name this.age=age } Person.prototype.sayHi=function(){//原型是公共方法 console.log(this.name+' say hi!!') } const p1=new Person('aa',12) const p2=new Person('bb',14) p1.sayHi() p2.sayHi() console.log(p1.__proto__===Person.prototype) //true console.log(p2.__proto__===Person.prototype)//true console.log(p1.__proto__===p2.__proto__)//true console.log(Person.prototype.constructor===Person)//true