Created
November 9, 2014 22:43
-
-
Save jrgleason/75addb71dba3df20f54b to your computer and use it in GitHub Desktop.
Step 1 for the
This file contains hidden or 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(name) { | |
this.legs = []; | |
this.name = name; | |
console.log("Running Constructor " + name); | |
} | |
Animal.prototype.sayHello = function() { | |
var message = "Hello my name is " + this.name + " and I have " + this.legs.length + " legs" | |
return message; | |
} | |
function Dog(name) { | |
this.legs.push("Right Front"); | |
this.legs.push("Left Front"); | |
this.legs.push("Right Hind"); | |
this.legs.push("Left Hind"); | |
} | |
Dog.prototype = new Animal(); | |
function Bird(name) { | |
this.legs.push("Right"); | |
this.legs.push("Left"); | |
} | |
Bird.prototype = new Animal(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment