remove
Mutates an array by removing elements for which the given function returns false.
- Use
Array.prototype.filter()to find array elements that return truthy values. - Use
Array.prototype.reduce()to remove elements usingArray.prototype.splice(). - The callback function is invoked with three arguments (value, index, array).