Lodash - pullAll method



Syntax

_.pullAll(array, values)

Gets all but the last element of array.

Arguments

  • array (Array) − The array to modify.

  • values (Array) − The values to remove.

Output

  • (Array) − Returns array.

Example

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

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

Save the above program in tester.js. Run the following command to execute this program.

Command

\>node tester.js

Output

[ 1, 3, 6 ]
lodash_array.htm
Advertisements