Skip to content

Instantly share code, notes, and snippets.

@alkrauss48
Created May 27, 2016 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alkrauss48/ae4b76ed4962fa03eaf7418c5c587d50 to your computer and use it in GitHub Desktop.
Save alkrauss48/ae4b76ed4962fa03eaf7418c5c587d50 to your computer and use it in GitHub Desktop.
var Person = {
name: '',
init: function(name){
this.name = name;
},
speak: function(){
console.log('My name is ' + this.name);
}
}
var bob = Object.create(Person);
bob.init('Bob');
bob.speak(); // 'My name is Bob'
Person.speak(); // 'My name is '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment