a function that adds from two invocations.
e.g. twoAdds(3)(4) -> 7
1 | function twoAdds (num) { |
currying
is the technique of converting a function that takes multiple arguments into a sequence of functions that each take a single argument.
Closure vs Currying
- Closure: allows a function to access variables in a parent scope without passing them in.
- Currying: the pattern of functions that immediately evaluate and return other functions.