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 | Company #8393428

tj.crow...@farsightsoftware.com | Office: +44 (0)20 3034 0132 -
Mobile: +44 (0)7717 842 414



If you've received this message in error, please let us know by
forwarding it to i...@farsightsoftware.com and then delete it from
your system. Please don't copy it or disclose its contents to anyone.
Separately, note that email sent over the internet without a digital
signature may be modified en route.


On Wed, May 23, 2018 at 10:15 PM, Andrea Giammarchi
<andrea.giammar...@gmail.com> wrote:
> 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. <jackalm...@gmail.com>
> wrote:
>>
>> On Wed, May 23, 2018 at 1:05 PM, Jordan Harband <ljh...@gmail.com> 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
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to