Last active
January 4, 2016 01:49
-
-
Save Chryus/8551399 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
var yeti = { | |
find: function fn() { | |
return this.appetite; | |
}, | |
appetite: "gigantic" | |
}; | |
var polar_bear = Object.create(yeti); | |
polar_bear.appetite = "huge"; | |
var seal = Object.create(polar_bear); | |
seal.appetite = "big"; | |
var arctic_hare = Object.create(seal); | |
var snow_mouse = Object.create(arctic_hare); | |
var snow_mole = Object.create(snow_mouse); | |
snow_mole.appetite = "tiny"; | |
console.log(yeti.find()); //gigantic | |
console.log(polar_bear.find()); //huge | |
console.log(seal.find()); //big | |
console.log(arctic_hare.find()); //big | |
console.log(snow_mouse.find()); //big | |
console.log(snow_mole.find()); //tiny |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment