idea: Array.prototype.remove

Jordan Harband ljharb at gmail.com
Mon Feb 4 06:40:08 UTC 2019


Why "remove" and not `.filter`, to produce a new array?

On Sun, Feb 3, 2019 at 9:56 PM #!/JoePea <joe at trusktr.io> wrote:

> I sometimes find myself doing things like
>
> ```js
> this.children.splice(this.children.indexOf(child), 1)
> ```
>
> but it seems that it will iterate the array twice. Maybe a new method can
> be introduced so engines can optimize it:
>
> ```js
> this.children.remove(child)
> // or
> this.children.remove(...childrenToRemove)
> ```
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190203/462725ad/attachment.html>


More information about the es-discuss mailing list