Skip to content

Instantly share code, notes, and snippets.

@brownsmith
Created February 14, 2018 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brownsmith/f28515f9a9f9dd6ae542952a665a6971 to your computer and use it in GitHub Desktop.
Save brownsmith/f28515f9a9f9dd6ae542952a665a6971 to your computer and use it in GitHub Desktop.
Little note on pure functions
// 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