JS如何捕获异常
2020-11-23 本文已影响0人
素明诚
一、使用try,catch
try{
//todo
}catch(ex){
console.log(ex)
//手动捕获 catch
}finally{
//todo
}
二、使用Windows.onerror
window.onerror = function(message,source,lineNumber){
//message,source,lineNumber等一系列的来捕获你想要的。
}