<script type="text/javascript">
function Animal () {
this.species="Animal";
}
function Cat(name,color){
this.name=name;
this.color=color;
}
//Apply 将父类对象的构造函数赋值到子类上,Animal.apply(this,arguments);
function Cat(name,color){
this.name=name;
this.color=color;
Animal.apply(this,arguments);
}
var cat1=new Cat("大毛","黄色");
alert(cat1.species); //Prototype 子对象原型prototype赋值父类对象,并将子类对象原型的构造函数赋值为子类
Cat.prototype = new Animal();
Cat.prototype.constructor=Cat;
var cat1=new Cat("大毛","黄色");
alert(cat1.species);
</script>