Skip to content

fix typo: fasle -> false #1214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: 优化表达 偏函数 -> 部分应用函数
  • Loading branch information
akfc58 committed Jul 20, 2024
commit 773b4cfc0ef34c8b6b3df86ae7d645ef75c64d1e
22 changes: 11 additions & 11 deletions 1-js/06-advanced-functions/10-bind/6-ask-partial/solution.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@


1. 使用包装(wapper)函数,箭头函数很简洁:

```js
askPassword(() => user.login(true), () => user.login(false));
```

现在它从外部变量中获得了 `user`,然后以常规方式运行它。
```js
askPassword(
() => user.login(true),
() => user.login(false)
);
```

2. 或者从 `user.login` 创建一个偏函数,该函数使用 `user` 作为上下文,并具有正确的第一个参数:
现在它从外部变量中获得了 `user`,然后以常规方式运行它。

2. 或者从 `user.login` 创建一个部分应用函数,该函数使用 `user` 作为上下文,并具有正确的第一个参数:

```js
askPassword(user.login.bind(user, true), user.login.bind(user, false));
```
```js
askPassword(user.login.bind(user, true), user.login.bind(user, false));
```
2 changes: 1 addition & 1 deletion 1-js/06-advanced-functions/10-bind/6-ask-partial/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ importance: 5

---

# 偏函数在登录中的应用
# 部分应用函数在登录中的应用

这个任务是比 <info:task/question-use-bind> 略微复杂的变体。

Expand Down