What is the right / best way to extend the javascript class so that class B inherits everything from class A (class B extends A)?
Take a look at Simple JavaScript Inheritance and JavaScript Template Inheritance .
The simplest method is probably functional inheritance, but there are pros and cons.
Douglas Crockford has very good explanations for JavaScript inheritance:
extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; };
JavaScript extension
You can also add filters to the for loop.