Removing an element from an array specifying a value in Javascript

前端 未结 5 477
独厮守ぢ
独厮守ぢ 2020-12-10 15:13

I have read this question:

Deleting array elements in JavaScript - delete vs splice

And it appears that both splice and delete require an index of the elemen

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 15:59

    underscore.js is a really awesome little library with a lot of good utility functions. In this case #reject would be appropriate.

    http://documentcloud.github.com/underscore/#reject

    (Although the internal method is of course similar to your manual index lookup and slice/splice).

提交回复
热议问题