Skip to content

Instantly share code, notes, and snippets.

@khanglu
Last active March 26, 2017 02:03
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 khanglu/d0a36fb246b48d4de09ca9bb513dddcf to your computer and use it in GitHub Desktop.
Save khanglu/d0a36fb246b48d4de09ca9bb513dddcf to your computer and use it in GitHub Desktop.
Example of curried function in ES6
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