var NormalFrog = function() { this.name = '青蛙'; this.legs = 4; }; NormalFrog.prototype.sayHi = function() { console.log('呱呱呱~ ' + this.name + '有' + this.legs + '条腿'); }; var WeirdFrog = function() { }; WeirdFrog.prototype = Object.assign({ }, NormalFrog.prototype, { legs: 8, name: '外星青蛙' }); var frog1 = new NormalFrog(); frog1.sayHi(); var frog2 = new WeirdFrog(); frog2.sayHi(); frog2.legs = 100; frog2.sayHi(); frog1.sayHi();