_.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
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
var array = ['a', 'b', 'c', 'd'];var pulled = _.pullAt(array, [1, 3]);console.log(array);// => ['a', 'c']console.log(pulled);// => ['b', 'd']
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .