Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Prototype design pattern in JS using Object.create
var personObject = {
name: "John Doe",
ridingBike: function(){
console.log(`I'm riding a bike, weeeeeeee!!!`);
},
walk: function(howMuch){
console.log(`${this.name} was walking ${howMuch}`);
}
};
var examplePerson = Object.create(personObject);
examplePerson.ridingBike();
examplePerson.walk('30km');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.