Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created November 21, 2011 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/1384024 to your computer and use it in GitHub Desktop.
Save Raynos/1384024 to your computer and use it in GitHub Desktop.
ES5 is verbose
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