Skip to content

pullAll

js
_.pullAll(array, values)

此方法与 _.pull 类似,不同之处在于它接受要删除的值的数组。

¥This method is like _.pull except that it accepts an array of values to remove.

注意:与 _.difference 不同,此方法会改变 array

¥Note: Unlike _.difference, this method mutates array.

新增于

¥Since

4.0.0

参数

¥Arguments

  1. array (数组):要修改的数组。

    ¥array (Array): The array to modify.

  2. values (数组):要删除的值。

    ¥values (Array): The values to remove.

返回

¥Returns

(数组):返回 array

¥(Array): Returns array.

示例

¥Example

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

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

Lodash v4.17 中文网 - 粤ICP备13048890号