Skip to content

Commit eb546f0

Browse files
authoredMar 30, 2020
Fixing "sum(1)" instead of "curriedSum(1)" (l. 42)
"sum(1)" doesn't return a wrapper, "curriedSum(1)" does.
1 parent 62299ed commit eb546f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎1-js/99-js-misc/03-currying-partials/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ alert( curriedSum(1)(2) ); // 3
3939
As you can see, the implementation is straightforward: it's just two wrappers.
4040

4141
- The result of `curry(func)` is a wrapper `function(a)`.
42-
- When it is called like `sum(1)`, the argument is saved in the Lexical Environment, and a new wrapper is returned `function(b)`.
42+
- When it is called like `curriedSum(1)`, the argument is saved in the Lexical Environment, and a new wrapper is returned `function(b)`.
4343
- Then this wrapper is called with `2` as an argument, and it passes the call to the original `sum`.
4444

4545
More advanced implementations of currying, such as [_.curry](https://lodash.com/docs#curry) from lodash library, return a wrapper that allows a function to be called both normally and partially:

0 commit comments

Comments
 (0)
Please sign in to comment.