> On May 3, 2016, at 8:01 PM, Michael Theriot <[email protected]> > wrote: > > I believe you can do this with `Reflect.construct`. > > ```js > function SubArray(arg1) { > return Reflect.construct(Array, arguments, SubArray);
this should probably be: return Reflect.construct(Array, arguments, new.target); If you don’t pass new.target subclasses of SubArray (whether defined using a class declaration or procedurally) won’t be correctly constructed > } > SubArray.prototype = Object.create(Array.prototype); > Reflect.setPrototypeOf(SubArray, Array); > > var arr = new SubArray(); > arr instanceof SubArray; // true > arr instanceof Array; // true > arr[5] = 0; // should exotically update length property > arr.length === 6; // true > ``` > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

