Skip to content

Commit 86189ab

Browse files
authored
fix: 优化
1 parent 8b7dc39 commit 86189ab

File tree

1 file changed

+7
-7
lines changed
  • 1-js/10-error-handling/1-try-catch/1-finally-or-code-after

1 file changed

+7
-7
lines changed

1-js/10-error-handling/1-try-catch/1-finally-or-code-after/task.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ importance: 5
1010

1111
```js
1212
try {
13-
work work
13+
// 工作
1414
} catch (err) {
15-
handle errors
15+
// 处理 error
1616
} finally {
1717
*!*
18-
cleanup the working space
18+
// 清理工作空间
1919
*/!*
2020
}
2121
```
2222
2. 第二个代码片段,将清空工作空间的代码放在了 `try...catch` 之后:
2323

2424
```js
2525
try {
26-
work work
26+
// 工作
2727
} catch (err) {
28-
handle errors
28+
// 处理 error
2929
}
3030
3131
*!*
32-
cleanup the working space
32+
// 清理工作空间
3333
*/!*
3434
```
3535

3636
我们肯定需要在工作后进行清理,无论工作过程中是否有 error 都不影响。
3737

38-
在这儿使用 `finally` 更有优势,还是说两个代码片段效果一样?如果在这儿有这样的优势,如果需要,请举例说明。
38+
在这儿使用 `finally` 更有优势,还是说两个代码片段效果一样?如果在这有这样的优势,如果需要,请举例说明。

0 commit comments

Comments
 (0)