T.J. Crowder tj.crowder at
Fri Nov 10 10:57:09 UTC 2017

On Fri, Nov 10, 2017 at 10:38 AM, Isiah Meadows <isiahmeadows at>
> My proposal is this: add a new `Array.prototype.remove(item)` method...

So not just a "would be nice," but you've provided a concrete reason for
putting it in the standard lib: Providing an optimized version vs. what can
be done in userland. Excellent. :-)

In a similar vein, is there a specific reason you're modifying the array in
place vs. creating a new one via `filter`? Memory churn? Callback cost
(though that's *amazingly* low in modern implementations as I'm sure you
know)? Lots of independent references to it? Are any/all things you've had
a real-world problem with around this? (That's a question, not veiled

FWIW, if it removes all occurrences of the items, I'd call it `removeAll`.
For some reason -- I'm not exactly sure why -- I'd expect `remove` to
remove only the first. Perhaps because `indexOf`/`findIndex` finds only the
first index, `find` finds only the first match, etc.? And it leaves the
door open for a `remove` that doesn't remove all (though that seems hard to
justify if a minimalist standard lib prevails). Web safety of the name
would need checking in any case. (Quick check says neither MooTools nor
Prototype adds either `remove` or `removeAll` to `Array.prototype`.)

-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list