-
-
Save VoloshchenkoAl/5708b38c0c640b75f0b8f2382d4ee28f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Animal(voice){ | |
this.voice = voice || 'grunt'; | |
} | |
Animal.prototype.speak = function(){ | |
console.log(this.voice); | |
} | |
function Cat(name, color){ | |
Animal.call(this, 'Meow'); | |
this.name = name; | |
this.color = color; | |
} | |
Cat.prototype = Object.create(Animal.prototype); | |
var fluffy = new Cat('Fluffy','black'); | |
console.log(fluffy); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment