how to use the without function from lodash in javascript

The without function from Lodash is used to creates an array with all given values removed. Here is an example of how to use it in JavaScript:

index.tsx
const _ = require('lodash');

const arr = [1, 2, 3, 4];

// remove 3 from array
const filteredArr = _.without(arr, 3);
console.log(filteredArr); // [1, 2, 4]
158 chars
8 lines

In this example, the without function removed the value of 3 from the arr array and returned a new filtered array. The new filtered array only contains the values of 1, 2, and 4.

gistlibby LogSnag