Skip to content

Instantly share code, notes, and snippets.

@ruliarmando
Created August 30, 2018 09:02
Show Gist options
  • Save ruliarmando/9dc30ff686717bc5d70132fbd5f1efcb to your computer and use it in GitHub Desktop.
Save ruliarmando/9dc30ff686717bc5d70132fbd5f1efcb to your computer and use it in GitHub Desktop.
Dynamic greater than function factory
const greaterThan = (thisNumber) => (anotherNumber) => anotherNumber > thisNumber;
const greaterThan10 = greaterThan(10);
const greaterThan2 = greaterThan(2);
console.log('12 > 10 = ', greaterThan10(12)); // 12 > 10 = True
console.log('8 > 10 = ', greaterThan10(8)); // 8 > 10 = False
console.log('3 > 2 = ', greaterThan2(3)); // 3 > 2 = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment