
jesteś tutaj
625
Stosowanie prototypów
function ShowDog(name, breed, weight, handler) {
Dog.call(this, name, breed, weight);
this.handler = handler;
}
ShowDog.prototype = new Dog();
ShowDog.prototype.constructor = ShowDog;
ShowDog.prototype.league = ”Sieciowice”;
ShowDog.prototype.stack = function() {
console.log(”Stoi i uwaĝa!”);
};
ShowDog.prototype.bait = function() {
console.log(”Prosi o smakoïyk”);
};
ShowDog.prototype.gait = function(kind) {
console.log(”Trenuje ” + kind + ”.” );
};
ShowDog.prototype.groom = function() {
console.log(”Czas pielÚgnacji sierĂci.”);
};
var fido = new Dog(”Burek”, ”mieszaniec”, 20);
var fluffy = new Dog(”Dino”, ”pudel”, 16); ...