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 to little of an improvement to become new Array method, I am
already confused with includes and contains that append and push, when Sets
have add, might cause me unnecessary headaches.

Regards



On Wed, May 23, 2018 at 10:14 PM, Tab Atkins Jr. <[email protected]>
wrote:

> On Wed, May 23, 2018 at 1:05 PM, Jordan Harband <[email protected]> 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.prototype.push which returns the array itself?
>
> The point is x.append(y) returning x, whereas x.push(y) returns y.
>
> ~TJ
> _______________________________________________
> 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

Reply via email to