Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种简单的方法可以在 Chrome 和 Safari 等原生浏览器调试器出现错误之前设置断点?如果没有,有什么工具可以完成这项任务?
在 Chrome 中打开开发人员工具并转到 Sources 选项卡。在右侧,您可以找到逐步执行代码的控件,您可以单击一次暂停按钮,它会变成蓝色。现在,当发生错误时,它将在该行暂停您的代码。
打开控制台试试这个:
var a = 0 debugger; //console will stop and start debug mode at this breakpoint. var b = a.test.test2; //this will fail