This post will discuss how to remove multiple values from an array in JavaScript. The solution should create a new array that excludes the specified values.

1. Using Array.prototype.filter() function

The idea is to use JavaScript filter() method to remove multiple items from an array. The following code example returns the new array of filtered values using the latest includes() method.

Download  Run Code

 
Here’s an alternative version which uses the indexOf() method instead of the includes() method.

Download  Run Code

2. Using Lodash/Underscore Library

This solution involves using external JavaScript libraries. The Underscore and Lodash library offer the _.without method, which returns a copy of the array excluding the specified values.

Here’s a simple example for removing multiple elements from the array using the _.without method

Download Code

 
Alternatively, you can use the _.difference method, as demonstrated below:

Download Code

That’s all about removing multiple values from an array in JavaScript.