3 ms·
ES6 adds minimal JS classes, which I'm a fan of. They're just syntactic sugar over: Animal = function () {}; Dog = function () {}; Dog.prototype =
by TazeTSchnitzel 13y ago
ES6 adds minimal JS classes, which I'm a fan of. They're just syntactic sugar over:
Animal = function () {};
Dog = function () {};
Dog.prototype = Object.create(Animal);
But this? This is an abomination.
- kybernetikos 13y agothat's Object.create(Animal.prototype), and they do add a little more, like a working 'super', and getting the .constructor property right.