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