Inverse of [].filter in JS?

arrays, filter, javascript

Solution

You can use an arrow function:

const a = someArr.filter(someFilter);
const a = someArr.filter(e => !someFilter(e));

Problem

I realize that I can do: ``` arr = arr.filter(function(n){ return !filterFunc(n); }); ``` But is there any way to just invert a filter without wrapping the filterer in an anon function? It just seems cumbersome.

Original source