Last active
March 26, 2017 02:03
-
-
Save khanglu/d0a36fb246b48d4de09ca9bb513dddcf to your computer and use it in GitHub Desktop.
Example of curried function in ES6
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
const add = (a, b) => console.log(a + b) | |
add(1, 2) // Result is 3 | |
const addCurried = a => b => console.log(a + b) | |
addCurried(1)(2) // Result is also 3 | |
const anotherAddCurried = a => b => c => console.log(a + b + c) | |
anotherAddCurried(1)(2)(3) // Result is 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment