// ⭐ 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).
function not(f) {
return function(...args) {
const result = f.apply(this, args); // call f(...args) with `this` context
return !result; // negate the result
};
}