try 语句的 catch 子句过去需要一个绑定
try {
doSomethingThatMightThrow();
} catch (exception) {
// ^^^^^^^^^
// We must name the binding, even if we don’t use it!
handleException();
}在 ES2019 中,catch 现在可以 在没有绑定时使用。如果你不需要处理异常的代码中的 exception 对象,这会很有用。
try {
doSomethingThatMightThrow();
} catch { // → No binding!
handleException();
}