Asuming:
function Animal(name) {
this.name = name;
}
Animal.prototype.move = function() {
// move
};
function Rabbit() {
// do rabbit stuff
}
我看到人们以不同的方式继承遗产。请参阅下面的代码,但哪种方法正确?他们似乎都以同样的方式工作
Rabbit.prototype = Rabbit.prototype;
// or
Rabbit.prototype = Rabbit.prototype.__proto__;
// or
Rabbit.prototype = new Rabbit();