Removes elements from array corresponding to indexes and returns an array of removed elements.
array
indexes
Note: Unlike at, this method mutates array.
at
5.11.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']
The array to modify.
Rest
The indexes of elements to remove.
Returns the new array of removed elements.
Removes elements from
array
corresponding toindexes
and returns an array of removed elements.Note: Unlike
at
, this method mutatesarray
.Since
5.11.0
See
[[pull]], [[pullAll]], [[pullAllBy]], [[pullAllWith]], [[remove]], [[reject]]
Example