Created
July 20, 2016 09:44
-
-
Save vasergen/07c67bd78181547392f00b18e4873230 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//OLOO - delegated objects | |
var Animal = { | |
init: function(name) { | |
this.name = name | |
}, | |
say: function() { | |
console.log(`I am ${this.name}`) | |
} | |
} | |
var Rabbit = Object.create(Animal) | |
Rabbit.skip = function() { | |
console.log(this.name + ': I skip') | |
} | |
var r1 = Object.create(Rabbit) | |
r1.init('r1') | |
r1.say() | |
r1.skip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment