What is the right/mest way to extend a javascript class so Class B inherits everything from the class A (class B extends A)?
+2
A:
Take a look at Simple JavaScript Inheritance and Inheritance Patterns in JavaScript.
The simplest method is probably functional inheritance but there are pros and cons.
cletus
2010-02-13 00:57:56
+2
A:
Douglas Crockford has some very good explanations of inheritance in JavaScript:
- prototypal inheritance: the 'natural' way to do things in JavaScript
- classical inheritance: closer to what you find in most OO languages, but kind of runs against the grain of JavaScript
Annabelle
2010-02-13 01:09:53