_.pullAt(array, [indexes])

sourcenpm package

Removes elements from array corresponding to indexes and returns an array of removed elements.Note: Unlike _.at, this method mutates array.

Since

3.0.0

Arguments

  • array (Array): The array to modify.
  • [indexes] (…(number|number[])): The indexes of elements to remove.

Returns

(Array): Returns the new array of removed elements.

Example

  1. var array = ['a', 'b', 'c', 'd'];
    var pulled = _.pullAt(array, [1, 3]);
    console.log(array);
    // => ['a', 'c']
    console.log(pulled);
    // => ['b', 'd']