<!DOCTYPE html>
<html>
<head>
<title>测试错误</title>
</head>
<body>
<div>错误机制</div>
</body>
<script>
try {
console.log(b);
} catch (error) {
console.log(error);
} finally {
console.log('我会执行性');
}
</script>
</html>
try中是可能出错的代码,catch将在错误触发的情况下执行,而finally怎么样都会执行.