为什么IE在调试模式下只是跳过错误,但没有调试就停止执行js

Why IE in debug mode just skips errors and goes further, but without debugging it stops executing js?

本文关键字:调试 js 执行 过错 模式 IE 为什么 错误      更新时间:2023-09-26

我有一些JS代码在这个地方崩溃了:

    alert("Before undefined error! "+i);        
 -> next = A[i][prop].nextSibling;
    alert("After undefined error! "+i);

错误发生,因为A[i]undefined,我得到'undefined' is null or not an object错误。

在通常的执行模式下,它只是在第二行之后停止,但是在调试模式下(我使用标准的开发人员工具),代码继续执行。为什么?

在IE开发人员工具中找到脚本面板的子菜单,然后单击配置图标(或按Ctrl+Alt+O)。选中"出错时中断"(或按Ctrl+Shift+E)以在该点停止执行。