Created
April 30, 2013 18:38
-
-
Save cianclarke/5490894 to your computer and use it in GitHub Desktop.
Prototypical Inheritance
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 Person(){ | |
} | |
var jos = new Person(); | |
var molly = new Person(); | |
Person.prototype.age = "28"; | |
Person.prototype.printAge = function(){ | |
console.log('Age is: ', this.age); | |
}; | |
console.log("Jos' age: ", jos.age); | |
molly.printAge(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment