Created
June 14, 2020 16:08
-
-
Save CodHeK/6ba5a4dce3a8ca7392e914556900d63e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 curry = (func) => { | |
return (a) => { | |
return (b) => { | |
return func(a, b); | |
} | |
} | |
} | |
const add = (a, b) => { | |
return a + b; | |
} | |
console.log(add(1, 2)); // 3 | |
const curryAdd = curry(add); | |
console.log(curryAdd(1)(2)); // 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment