JavaScript中的异常捕获
在JavaScript可以使用try...catch来进行异常处理。例如:
try {throw new Date();// 抛出当前时间对象 } catch (e) {alert(e.toLocaleString());// 使用本地格式显示当前时间 }
?