Skip to content

Instantly share code, notes, and snippets.

@cianclarke
Created April 30, 2013 18:38
Show Gist options
  • Save cianclarke/5490894 to your computer and use it in GitHub Desktop.
Save cianclarke/5490894 to your computer and use it in GitHub Desktop.
Prototypical Inheritance
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