1、try-catch
普通报错无法接着执行之后语句
<script>con.log("hello world")console.log(2);</script>

try-catch语句下不影响接下里的语句执行
<script>try{con.log("hello world")}catch(err){console.log(err);/* 抛出一个错误 *///throw new Error("错误")}console.log(2);</script>

/* 抛出一个错误 */throw new Error("错误")
2、finally
finally不管有没有异常,都会执行
<!--try-catch-finallyfinally不管有没有异常,都会执行--><script>try{console.log(1);con.log("hello world")}catch(err){console.log(err);}finally{console.log(2);}</script>

