> function createArraySubclass(proto,...values) {
> return proto <| [...values].{
> [Array.derivedArrayKey](){return proto<| [ ]}
> }
> }
I’m curious: Why wouldn’t one extend Array, instead?
function SubArray() {
}
SubArray.prototype = Object.create(Array.prototype);
SubArray.prototype.pushAll = function() {
Array.prototype.push.apply(this, arguments);
return this;
}
var s = new SubArray().pushAll(3,4,5);
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss