// ⭐ logical negation of f// - that is: not(f)(x) returns !f(x)// - we can't write (!f)(x) directly, but now we can write not(f)(x).functionnot(f) {returnfunction(...args) {constresult=f.apply(this, args); // call f(...args) with `this` contextreturn!result; // negate the result };}
example
constisEven= x => x %2===0;constisOdd=not(isEven);[1,1,3,5,5].every(isOdd) // true