Skip to content

Commit 393c05f

Browse files
committed
Update task.md
1 parent fe4d147 commit 393c05f

File tree

1 file changed

+7
-5
lines changed
  • 1-js/05-data-types/08-weakmap-weakset/02-recipients-when-read

1 file changed

+7
-5
lines changed

1-js/05-data-types/08-weakmap-weakset/02-recipients-when-read/task.md

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

55
# 保存阅读日期
66

7-
这里有一个和[前一任务](info:task/recipients-read)相像的消息数组。情境相似
7+
这儿有一个和 [上一个任务](info:task/recipients-read) 类似的 `messages` 数组。场景也相似
88

99
```js
1010
let messages = [
11-
{text: "Hello", from: "John"},
12-
{text: "How goes?", from: "John"},
13-
{text: "See you soon", from: "Alice"}
11+
{text: "Hello", from: "John"},
12+
{text: "How goes?", from: "John"},
13+
{text: "See you soon", from: "Alice"}
1414
];
1515
```
1616

1717
现在的问题是:你建议采用什么数据结构来保存信息:“消息是什么时候被阅读的?”。
1818

19-
在前一个任务中我们只需要保存“是/否”。现在我们需要保存日期,并且它也应该在消息没有了就消失。
19+
在前一个任务中我们只需要保存“是/否”。现在我们需要保存日期,并且它应该在消息被垃圾回收时也被从内存中清除。
20+
21+
P.S. 日期可以存储为内建的 `Date` 类的对象,稍后我们将进行介绍。

0 commit comments

Comments
 (0)