We have two threads going on this with the same (and differeing)
points being raised in both, let's pick it up in the better-named
["Array.prototype.append?"
thread](https://esdiscuss.org/topic/array-prototype-append).
-- T.J. Crowder
Farsight Software Ltd | 20-22 Wenlock Road, London N1 7GU |
Just one thought ...
```js
Object.defineProperty(Array.prototype, "append", {
value(...sources) {
this.push(...[...sources]);
return this;
},
writable: true,
configurable: true
});
```
... but also another one ...
```js
(array.push(...sources), array)
```
it seems
On Wed, May 23, 2018 at 1:05 PM, Jordan Harband wrote:
> `array.push(...sources)`, not sure why we'd need "append".
>From the original email (a bit buried and hard to find due to broken
threading, admittedly):
> Has anyone ever suggested Array.prototype.append as an
`array.push(...sources)`, not sure why we'd need "append".
On Wed, May 23, 2018 at 1:25 PM, T.J. Crowder <
tj.crow...@farsightsoftware.com> wrote:
> On Wed, May 23, 2018 at 5:56 PM, Alexander Lichter wrote:
> > An optimization would be great because in comparison to the
On Wed, May 23, 2018 at 5:56 PM, Alexander Lichter wrote:
> An optimization would be great because in comparison to the existing
concat
> method, rest/spread is significantly slower at the moment (see
> https://jsperf.com/single-array-composition)
There's a limit to how much
An optimization would be great because in comparison to the existing
concat method, rest/spread is significantly slower at the moment (see
https://jsperf.com/single-array-composition)
On 23.05.2018 18:34, Ben Fletcher wrote:
Does the `[...oldArr, ...elementsToPushArr]` pattern take care of
Does the `[...oldArr, ...elementsToPushArr]` pattern take care of that for
you? I've always assumed it's much less performant than your form would be,
but I (naively) suppose the implementation could be optimized like anything
else
On Wed, May 23, 2018 at 8:01 AM
7 matches
Mail list logo