Created
January 5, 2017 15:45
-
-
Save rpunkfu/04aaf748c76bbf5e654016ddc5424972 to your computer and use it in GitHub Desktop.
Just a quick example
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
| const Dog = { | |
| woof () { return `Woof! I am ${this.name}!` } | |
| } | |
| const Yoko = Object.assign(Object.create(Dog), { name: 'Yoko' }) | |
| const Yoshi = Object.assign(Object.create(Dog), { name: 'Yoshi' }) | |
| Yoko.woof() // Returns 'Woof! I am Yoko!' | |
| Yoshi.woof() // Returns 'Woof! I am Yoshi!' | |
| Dog.woof = function () { return `W000f! I am still ${this.name}, but much cooler!` } | |
| Yoko.woof() // Returns 'W000f! I am still Yoko, but much cooler!' | |
| Yoshi.woof() // Returns 'W000f! I am still Yoshi, but much cooler!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment