Created
February 14, 2018 13:21
-
-
Save brownsmith/f28515f9a9f9dd6ae542952a665a6971 to your computer and use it in GitHub Desktop.
Little note on pure functions
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
// A function is only pure if, given the same input, it will always produce the same output. | |
const highpass = (cutoff, value) => value >= cutoff; | |
highpass(5, 123); // true | |
highpass(5, 6); // true | |
highpass(5, 18); // true | |
highpass(5, 5); // true | |
highpass(5, 1); // false | |
highpass(5, 3); // false | |
highpass(5, 4); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment