Remove value by predicate function from array
通过 predicate 方法,从数组中移除值
also see remove
the array
the predicate function
true
false
const arr = [1, 2, 3]removeBy(arr, n => n === 2) // => trueconsole.log(arr) // => [1, 3] Copy
const arr = [1, 2, 3]removeBy(arr, n => n === 2) // => trueconsole.log(arr) // => [1, 3]
const arr = [ { id: 1, csv: 1 }, { id: 2, csv: 1 }, { id: 3, csv: 1 },]removeBy(arr, item => item.id === 2) // => trueconsole.log(arr) // => [{ id: 1, csv: 1 }, { id: 3, csv: 1 }] Copy
const arr = [ { id: 1, csv: 1 }, { id: 2, csv: 1 }, { id: 3, csv: 1 },]removeBy(arr, item => item.id === 2) // => trueconsole.log(arr) // => [{ id: 1, csv: 1 }, { id: 3, csv: 1 }]
Remove value by predicate function from array
通过 predicate 方法,从数组中移除值
also see remove