Created
December 12, 2018 13:27
-
-
Save quisido/9a460676939e8b7396304ae327c47a2e to your computer and use it in GitHub Desktop.
Variable length currying in JavaScript
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
// This cannot be true with the following statement. | |
addSubtract(1)(2)(3) === 0; | |
// This cannot be true with the preceding statement. | |
addSubtract(1)(2)(3)(4)(5)(6) === 5; | |
// This can be true: | |
addSubtract(1)(2)(3) + addSubtract(1)(2)(3)(4)(5)(6) === 5; | |
// These can be true too: | |
+addSubtract(1)(2)(3) === 0; | |
+addSubtract(1)(2)(3)(4)(5)(6) === 5; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment