3 ms·
I'm curious as I haven't found a good coding style guide about object inheritance in ES5. I usually write this even though it's a bit verbose: function Chil
by dkrvt 11y ago
I'm curious as I haven't found a good coding style guide about object inheritance in ES5.
I usually write this even though it's a bit verbose:
function Child() {
Parent.call(this);
}
Child.prototype = Object.create(Parent.prototype);
Child.prototype.constructor = Child;
Any opinion on this or link to a good guide?
- yefim 11y agoES6 actually solves this with it's new Class syntax. class Child extends Parent { }