pullAt source npm

_.pullAt(array, [indexes])

Removes elements from array corresponding to indexes and returns an array of removed elements.

Note: Unlike _.at, this method mutates array.

Arguments

  1. array (Array)

    The array to modify.

  2. [indexes] (...(number|number[])

    The indexes of elements to remove, specified individually or in arrays.

Returns (Array)

Returns the new array of removed elements.

Example

var array = [5, 10, 15, 20];
var evens = _.pullAt(array, 1, 3);

console.log(array);
// => [5, 15]

console.log(evens);
// => [10, 20]