Removes elements from array corresponding to indexes and returns an array of removed elements.
array
indexes
Note: Unlike at, this method mutates array.
at
The array to modify.
Optional
Rest
The indexes of elements to remove.
Returns the new array of removed elements.
3.0.0
pull, pullAll, pullAllBy, pullAllWith, remove, reject
const array = ['a', 'b', 'c', 'd']const pulled = pullAt(array, [1, 3])console.log(array)// => ['a', 'c']console.log(pulled)// => ['b', 'd'] Copy
const array = ['a', 'b', 'c', 'd']const pulled = pullAt(array, [1, 3])console.log(array)// => ['a', 'c']console.log(pulled)// => ['b', 'd']
Removes elements from
array
corresponding toindexes
and returns an array of removed elements.Note: Unlike
at
, this method mutatesarray
.