继承
function SuperType(name,age) { this.name = name; this.age = age; } SuperType.prototype.sayName = function(){ console.log(this.name); } function SubType(name,age,sex) { SuperType.call(this,name,age); this.sex = sex; } SubType.prototype = new SuperType(); SubType.prototype.constructor = SubType; SubType.prototype.saySex = function(){ console.log(this.sex); } let obj = new SubType('ls','26','male'); console.log(Object.getPrototypeOf(obj))