Ask HN: Is there a consensus on the way to do JS inheritance?
2 points| ldidi | 11 years ago
- Subclass.prototype = new Class()
- Subclass.prototype = Object.create( Class.prototype )
- Fiber: https://github.com/linkedin/Fiber
None of those solutions were acceptable: the two firsts have issues with method overriding and super() invocation, the latter is too verbose to implement.
It seems that most articles on the subject link to John Resig's Simple Javascript Inheritance: http://ejohn.org/blog/simple-javascript-inheritance/, but that one is from 2008 and I was wondering if there's one "modern" way to do JS inheritance and that most people agree on.
Is there such a thing? Is there a library that implements it?
Side note: Please avoid things like "you're trying to do things that JS is not meant for", I'm just trying to answer the how, not the why.
[+] [-] tgriesser|11 years ago|reply
https://github.com/isaacs/inherits
[+] [-] unknown|11 years ago|reply
[deleted]