Skip to content

Instantly share code, notes, and snippets.

@quisido
Created December 12, 2018 13:31
Show Gist options
  • Save quisido/8a4836cc2faa4ef2ecb3dc01811b1d01 to your computer and use it in GitHub Desktop.
Save quisido/8a4836cc2faa4ef2ecb3dc01811b1d01 to your computer and use it in GitHub Desktop.
Variable length currying in JavaScript
const addTo1 = addSub(1); // nums = [1]
+addTo1(2); // 3 nums = [ 1, 2 ]
+addTo1(2); // 1 nums = [ 1, 2, 2 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment