Remove Object from Array using JavaScript

前端 未结 29 2590
南笙
南笙 2020-11-22 10:24

How can I remove an object from an array? I wish to remove the object that includes name Kristian from someArray. For example:

som         


        
29条回答
  •  独厮守ぢ
    2020-11-22 10:40

    Vote for the UndercoreJS for simple work with arrays.

    _.without() function helps to remove an element:

     _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
        => [2, 3, 4]
    

提交回复
热议问题