function Pet(name, species){
this.name = name;
this.species = species;
}
Pet.prototype.view = function view(){
return this.name + " is a " + this.species + "!";
};
我想我可以通过这种方式实现上述功能
function Pet(name, species){
this.name = name;
this.species = species;
this.view = function () {
return this.name + " is a " + this.species + "!";
}
}
那么原型的用途是什么?