Skip to content

Commit 6c830f1

Browse files
authored
Update task.md
1 parent 61469d8 commit 6c830f1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • 1-js/05-data-types/05-array-methods/12-reduce-object

1-js/05-data-types/05-array-methods/12-reduce-object/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 4
44

55
# 从数组创建键(值)对象
66

7-
假设我们有以下形式的用户数组 `{id:..., name:..., age... }`
7+
假设我们收到了一个用户数组,形式为:`{id:..., name:..., age... }`
88

99
创建一个函数 `groupById(arr)` 从该数组创建对象,以 `id` 为键(key),数组项为值。
1010

@@ -20,7 +20,7 @@ let users = [
2020
let usersById = groupById(users);
2121

2222
/*
23-
// 调用方法后我们得到:
23+
// 调用函数后我们得到:
2424
2525
usersById = {
2626
john: {id: 'john', name: "John Smith", age: 20}
@@ -31,8 +31,8 @@ usersById = {
3131
```
3232

3333

34-
处理服务端数据时,此功能很有用
34+
处理服务端数据时,这个函数很有用
3535

36-
在这个任务里我们假设 `id` 是唯一的。没有哪两个数组项具有相同的 `id`
36+
在这个任务里我们假设 `id` 是唯一的。没有两个具有相同 `id` 的数组项
3737

38-
请使用数组 `.reduce` 方法解决
38+
请在解决方案中使用数组的 `.reduce` 方法

0 commit comments

Comments
 (0)