Remove multiple indices from array

后端 未结 8 2142
一整个雨季
一整个雨季 2020-12-30 12:31

I have an array and I want to remove a bunch of indices

var arr = [0,1,2,3,4,5,6]
var rmIndices = [1,4,5]

What is the best way to remove in

8条回答
  •  执念已碎
    2020-12-30 13:15

    Using lodash https://lodash.com/

    var arr = [0,1,2,3,4,5,6]
    var rmIndices = [1,4,5]
    _.pullAt(arr, rmIndices);
    

提交回复
热议问题