Garrett Smith (2015-04-11T01:57:03.000Z)
On 4/10/15, Axel Rauschmayer <axel at rauschma.de> 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() {
     super(1,2,3,4,5);
  }
});
alert(myArray.length); // it's 0 in Babel.

-- 
Garrett
@xkit
ChordCycles.com
garretts.github.io
personx.tumblr.com
d at domenic.me (2015-04-19T23:38:03.507Z)
On 4/10/15, Axel Rauschmayer <axel at rauschma.de> 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:

```js
var myArray = (new class B extends Array {
   constructor() {
     super(1,2,3,4,5);
  }
});
alert(myArray.length); // it's 0 in Babel.
```