Created
May 27, 2016 14:43
-
-
Save alkrauss48/ae4b76ed4962fa03eaf7418c5c587d50 to your computer and use it in GitHub Desktop.
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
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