Skip to content

Instantly share code, notes, and snippets.

@imjacobclark
Created February 22, 2014 18:29
Show Gist options
  • Save imjacobclark/9159579 to your computer and use it in GitHub Desktop.
Save imjacobclark/9159579 to your computer and use it in GitHub Desktop.
var Person = {
firstName: "Jacob",
lastName: "Clark",
sayName: function(){
return "My name is " + this.firstName + " " + this.lastName;
}
}
var jacobClark = Object.create(Person, {
firstName: {
value: "Jacob"
},
lastName: {
value: "Clark"
}
});
var thomasHarrison = Object.create(Person, {
firstName: {
value: "Thomas"
},
lastName: {
value: "Harrison"
}
});
console.log(jacobClark.sayName());
console.log(thomasHarrison.sayName())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment