现在,已经知道了原型对象,原型链的实现,原型链式继承的缺陷;那么如何避免这个缺陷?
//定义一个CarModel类
function CarModel(c){
      this.color=c||"白色";
      this.arr=[1,2,3];
      this.getColor=function(){
	        console.log(‘我的颜色是‘+this.color);
      }
}
//car类有自己的属性,比如品牌
function Car(brand){
	 CarModel.call(this);//借用父类的构造函数
	 this.brand=brand;
     this.getBrand=function(){
	      console.log(‘我的品牌是‘+this.brand);
      }
}
//car类需要继承自carmodel,汽车共有的属性color放在carmodel上
Car.prototype=new CarModel();
var car1=new Car("丰田");
console.log(car1);
结果:

达到的效果相当于,子类拷贝了一份父类的方法和属性,加上自己的方法和属性;
优点:
缺点:
原文:http://www.cnblogs.com/llauser/p/6718587.html