function throwError(){ throw new Error('ERROR'); } try{ setTimeout(throwError, 0); } catch(e){ alert(e);//这里的异常无法捕获}
这样可以
function throwError(){ try{ throw new Error('ERROR'); } } catch(e){ alert(e);//这里的异常无法捕获} setTimeout(throwError, 0);
为什么第一个例子的异常不能捕获?
白衣染霜花
相关分类