fn
.!
) operator on the result of calling fn
with any supplied args
.const complement = fn => (...args) => !fn(...args);
const isEven = num => num % 2 === 0;
const isOdd = complement(isEven);
isOdd(2); // false
isOdd(3); // true
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️