> On Apr 10, 2015, at 10:29 PM, Axel Rauschmayer <a...@rauschma.de> wrote:
>
> No engine has implemented subclassing of `Array`, yet:
> http://kangax.github.io/compat-table/es6/#Array_is_subclassable
> <http://kangax.github.io/compat-table/es6/#Array_is_subclassable>
>
> And, as Sebastian mentioned, you can’t transpile it, because it depends on
> the cooperation of `Array`: it becomes the base constructor and allocates an
> exotic array instance (with special handling for `length` etc.) whose
> prototype is `new.target`.
note totally true:
```js
class SubArray extends Array {
constructor(…args) {
let newObj = new Array(…args);
newObj.__proto__ = SubArray.prototype; //or new.target.prototype
return newObj
}
subclassMethiod() {}
}
```
Allen
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss