構造函數+原型法函數
function person(name,age){ this.name = name; this.age = age; } person.prototype.say = function(){ console.log(this.name+":"+this.age); } function superman(name,age){ person.call(this,name,age); } superman.prototype = new person(); superman.prototype.fight = function(){ this.say(); console.log("fighting..."); } var s = new superman('superman',29); s.fight();