js- throw and try-catch-finally

2023-03-09,,

总结一下:

1.throw 抛出错误

2.在使用try-catch时 try{}抛出错误,catch{}块语句才执行,另外catch(e)可创建例如e的标识符,对try{}块抛出异常进行捕捉

3.在使用到finally{}块时,其抛出值为try-catch-finally的抛出值,原理:先将已打算抛出的return或throw进行挂起然后重写覆盖,抛出

4.try-catch{}进行嵌套时子层和父层相隔开 :就是父层中的throw 不影响子层中的catch

js- throw and try-catch-finally的相关教程结束。

《js- throw and try-catch-finally.doc》

下载本文的Word格式文档,以方便收藏与打印。