function c1(name){ this.name=name; this.hello=function(){ console.log(this.name); }; } c2.prototype=new c1(); function c2(name){ var params=Array.prototype.slice.call(arguments); c1.apply(this,params); //將this傳遞給父類 } var obj1=new c1('zy') var obj2=new c2('zyy'); obj2.hello() obj1.hello();