Created
November 21, 2011 21:35
-
-
Save Raynos/1384024 to your computer and use it in GitHub Desktop.
ES5 is verbose
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 Animal = { | |
legs: 4, | |
walk: function () { ... } | |
}; | |
var Cat = Object.create(Animal, { | |
nyan: { | |
value: function () { ... }, | |
configurable: true | |
}, | |
constructor: { | |
value: function () { this.lives = 9; }, | |
configurable: true | |
} | |
}); | |
var cat = Object.create(Cat); | |
cat.constructor(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment