File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -432,10 +432,12 @@ try {
432
432
433
433
上面代码中,进入` catch ` 代码块之后,一遇到` throw ` 语句,就会去执行` finally ` 代码块,其中有` return false ` 语句,因此就直接返回了,不再会回去执行` catch ` 代码块剩下的部分了。
434
434
435
+ ` try ` 代码块内部,还可以再使用` try ` 代码块。
436
+
435
437
``` javascript
436
438
try {
437
439
try {
438
- console .log (' Hello world!' ); // 报错
440
+ consle .log (' Hello world!' ); // 报错
439
441
}
440
442
finally {
441
443
console .log (' Finally' );
@@ -445,10 +447,10 @@ try {
445
447
console .error (error .message );
446
448
}
447
449
// Finally
448
- // console is not defined
450
+ // consle is not defined
449
451
```
450
452
451
- 上面代码中,` try ` 里面还有一个` try ` 。内层的` try ` 报错,这时会执行内层的` finally ` 代码块,然后抛出错误,被外层的` catch ` 捕获。
453
+ 上面代码中,` try ` 里面还有一个` try ` 。内层的` try ` 报错( ` console ` 拼错了) ,这时会执行内层的` finally ` 代码块,然后抛出错误,被外层的` catch ` 捕获。
452
454
453
455
## 参考连接
454
456
You can’t perform that action at this time.
0 commit comments