js继承实现

function Car(Name,Age){
  this.Name = Name;
  this.Age = Age;
}
Car.prototype.showAge = function(){
   alert(this.Age);
}

function MoCar(Name,Age){
   Car.call(this,Name,Age);
}
MoCar.prototype = new Car();
MoCar.prototype.showName = function(){
   alert(this.Name);
}

var obj = new MoCar("jianboqi",12);
obj.showName();
obj.showAge();
原文地址:https://www.cnblogs.com/jianboqi/p/2947641.html