Created
August 22, 2018 00:57
-
-
Save NathanKleekamp/21233c6147d866357e435ed36eed5764 to your computer and use it in GitHub Desktop.
isOdd utility fn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const complement = fn => (...args) => !fn.apply(null, args); | |
const isEven = x => x % 2 === 0; | |
const isOdd = complement(isEven); | |
isEven(2); // false | |
isEven(1); // true | |
isEven(0); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment