8
EliaP
6y

I can't believe that a modern language like JS is still lacking basic utilities like removing something from an array by value

Comments
  • 6
    Don't worry, there are 1001 frameworks that have that feature.
  • 5
  • 4
    More than one way to skin a cat:

    arr = arr.filter(item => item !== val);
  • 3
    Array.prototype.splice() i think op does know about this, but does it compare to python's remove or list comprehension? Ño

    We do have map and filter in JS though if you don't mind using a lil bit of extra power in your app.

    Still messy but I love JS so fuck it
  • 1
    Yes I know about splice, filter and all that. What I meant to say is that it shouldn't be so "difficult", it should be a simple array.remove(value).
  • 0
    @EliaP yeah I can't blame you.
Add Comment