mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
33 lines
543 B
Plaintext
33 lines
543 B
Plaintext
function Animal(name) {
|
|
this.name = name;
|
|
}
|
|
|
|
Animal.prototype.sayHello = function() {
|
|
return 'Hello from ' + this.name;
|
|
};
|
|
|
|
Animal.prototype.makeNoise = function() {
|
|
return this.noise || '<chirp>';
|
|
};
|
|
|
|
function Dog(name, breed) {
|
|
this.name = name;
|
|
this.breed = breed;
|
|
this.noise = 'Woof!';
|
|
}
|
|
|
|
Dog.prototype = new Animal();
|
|
|
|
Dog.prototype.sayExtendedHello = function() {
|
|
return this.sayHello() + ', ' + this.breed;
|
|
};
|
|
|
|
Dog.prototype.bark = function() {
|
|
return this.noise;
|
|
};
|
|
|
|
module.exports = {
|
|
Animal: Animal,
|
|
Dog: Dog,
|
|
};
|