Lodash - pullAll 方法

语法

_.pullAll(array, values)

获取数组中除最后一个元素之外的所有元素。

参数

  • array (Array) − 要修改的数组。

  • values (Array) − 要删除的值。

输出

  • (Array) − 返回数组。

示例

var _ = require('lodash');
var list = [1, 2, 3, 2, 5, 6, 2];

_.pullAll(list,[2,5])
console.log(list);

将上述程序保存在tester.js中。运行以下命令执行该程序。

命令

\>node tester.js

输出

[ 1, 3, 6 ]

lodash_array.html