find elements by value in array and remove multiple javascript code example

Example 1: remove multiple values from array javascript

const nums = [1, 2, 3, 4, 5, 6];
const remove = [1, 2, 4, 6];

function removeFromArray(original, remove) {
  return original.filter(value => !remove.includes(value));
}

Example 2: js remove several elements from array

var ar = ['zero', 'one', 'two', 'three'];ar.shift(); // returns "zero"console.log( ar ); // ["one", "two", "three"]

Example 3: js remove several elements from array

var array = [1, 2, 3, 4];var evens = _.remove(array, function(n) { return n % 2 === 0;});console.log(array);// => [1, 3]console.log(evens);// => [2, 4]