“设置下一条语句”功能存在于Chrome的开发工具或Firebug中?

编程入门 行业动态 更新时间:2024-10-14 22:18:17
本文介绍了“设置下一条语句”功能存在于Chrome的开发工具或Firebug中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

IE的开发工具,更具体而言,它的JavaScript调试器提供了一个Set next statement命令,使您能够指定下一个应执行的语句。这样,您可以有效地跳过功能的某些部分,甚至能够(再次有效地)从早期的功能返回。

IE's development tools, more specifically its JavaScript debugger, offer a "Set next statement" command, which enables you to specify which statement should be executed next. That way, you can effectively skip certain parts of functions or even (again, effectively) return from a function early.

所以,对于这个函数...

So, for this function...

function test () { alert(1); alert(2); alert(3); }

如果我们在第一个警报上设置了一个断点,然后调用功能,我们可以执行第一个警报(F10),然后右键单击第三个警报并选择设置下一个语句。现在,如果我们按F10,第三个警报将被执行,所以有效地跳过第二个警报。

If we set a break-point on the first alert, and then invoke the function, we can execute the first alert (F10), and then right-click on the third alert and choose "Set next statement". Now, if we press F10, the third alert will be executed, so, effectively, the second alert was skipped.

(在IE测试这里:---用F12打开IE的工具,切换到脚本选项卡,设置断点,按开始调试按钮,必要时刷新页面

(Test in IE here: --- open IE's tools with F12, switch to "Script" tab, set breakpoint, press "Start debugging" button, refresh page if necessary)

我喜欢这个设置下一个语句功能。不过,我没有注意到Chrome的开发工具或Firebug。这些功能是否存在于这些调试器中?

I like this "set next statement" feature. However, I did not notice it in Chrome's dev tools or in Firebug. Does this feature exist in those debuggers?

推荐答案

Chrome DevTools没有设置下一个语句,您可以通过编辑JavaScript来更明确地定义下一个语句而在断点处暂停。

While Chrome DevTools doesn't have "Set Next Statement", you can more explicitly define next statement by just editing the JavaScript while it's paused at the breakpoint.

我已经为截屏您要显示Chrome DevTools Live Edit +断点调试。

I've made a short screencast for you to show Chrome DevTools Live Edit + Breakpoint Debugging.

本质上:在断点处,通过单击脚本面板并进行更改即可实时编辑脚本。命中 cmd + s 保存。然后再通过该代码进行新的更改。比起绕过代码更强大,您也可以添加新功能。

In essence: while at a breakpoint, live edit your script by clicking into the Scripts panel and making changes. Hit cmd + s to save. Then walk through that code with its new changes. Far more powerful than just bypassing code, you could be adding new functionality as well.

更多推荐

“设置下一条语句”功能存在于Chrome的开发工具或Firebug中?

本文发布于:2023-11-12 19:54:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582386.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:开发工具   语句   功能   下一条   Firebug

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!