File tree 2 files changed +3
-3
lines changed
1-js/06-advanced-functions/11-currying-partials
2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ The task is a little more complex variant of <info:task/question-use-bind>.
8
8
9
9
The ` user ` object was modified. Now instead of two functions ` loginOk/loginFail ` , it has a single function ` user.login(true/false) ` .
10
10
11
- What to pass ` askPassword ` in the code below, so that it calls ` user.login(true) ` as ` ok ` and ` user.login(fail ) ` as ` fail ` ?
11
+ What to pass ` askPassword ` in the code below, so that it calls ` user.login(true) ` as ` ok ` and ` user.login(false ) ` as ` fail ` ?
12
12
13
13
``` js
14
14
function askPassword (ok , fail ) {
Original file line number Diff line number Diff line change 5
5
6
6
# Currying and partials
7
7
8
- Till now we were only talking about binding ` this ` . Now let 's make a step further.
8
+ Until now we have only been talking about binding ` this ` . Let 's take it a step further.
9
9
10
10
We can bind not only ` this ` , but also arguments. That's rarely done, but sometimes can be handy.
11
11
@@ -146,7 +146,7 @@ More advanced implementations of currying like [_.curry](https://lodash.com/docs
146
146
147
147
``` js
148
148
function curry (f ) {
149
- return function (..args ) {
149
+ return function (... args ) {
150
150
// if args.length == f.length (as many arguments as f has),
151
151
// then pass the call to f
152
152
// otherwise return a partial function that fixes args as first arguments
You can’t perform that action at this time.
0 commit comments