Skip to content

Instantly share code, notes, and snippets.

@gremz
Created November 19, 2014 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gremz/3b6c37ba4986732d7591 to your computer and use it in GitHub Desktop.
Save gremz/3b6c37ba4986732d7591 to your computer and use it in GitHub Desktop.
function Animal() {
this.name = 'I am a generic Animal';
}
function Cat() {
this.name = 'Cat'
this.sound = 'purr';
}
Cat.prototype = new Animal();
Animal.prototype.isAnimal = function() { return true; };
var fluffy = new Cat();
fluffy.name; // Cat
fluffy.sound; // purr
fluffy.isAnimal(); // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment