_.pullAt

_.pullAt(array, [indexes])

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

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

Returns

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

Example

var array = ['a', 'b', 'c', 'd'];

var pulled = _.pullAt(array, [1, 3]);
 

console.log(array);
// => ['a', 'c']
 

console.log(pulled);
// => ['b', 'd']
doc_Lodash
2016-11-27 16:39:53
Comments
Leave a Comment

Please login to continue.