function User(){} User.prototype.name=function(){ console.log("user.name"); } function Admin(){} //方式1 //Admin.prototype.__proto__==Object.prototype console.log(Admin.prototype.__proto__==Object.prototype) // Admin.prototype.__proto__=User.prototype; //方式2 Admin.prototype=Object.create(User.prototype) Admin.prototype.role=function(){ console.log("admin.role"); } function Member(){} Member.prototype.role=function(){ console.log("member.role"); } let a=new Admin(); a.role();