super() on class that extends

Garrett Smith dhtmlkitchen at
Sat Apr 11 01:57:03 UTC 2015

On 4/10/15, Axel Rauschmayer <axel at> wrote:
> The reason why you need to call the super-constructor from a derived class
> constructor is due to where ES6 allocates instances - they are allocated
> by/in the base class (this is necessary so that constructors can be
> subclassed that have exotic instances, e.g. `Array`):
Can you please explain how extending Array works. Also what is the
optional identifier optional for in ClassExpression:

var myArray = (new class B extends Array {
   constructor() {
alert(myArray.length); // it's 0 in Babel.


More information about the es-discuss mailing list