扩展构造函数以接收参数
function Dog(name, color) {
this.name=name;
this.color=color;
this.numLegs=4;
}
let terrier=new Dog("John","yellow");
function Dog(name, color) {
this.name=name;
this.color=color;
this.numLegs=4;
}
let terrier=new Dog("John","yellow");