JavaScript:如何在Chrome调试器工具中设置条件断点 [英] JavaScript :How to set a Conditional Break Point in Chrome debugger tools

查看:2963
本文介绍了JavaScript:如何在Chrome调试器工具中设置条件断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用Google Chrome调试器工具(F12)



我的问题是,是否可以在Google Chrome中设置条件转折点?



在我的代码中,我想设置一个断点,如果秒值等于50 ??

  s = date.getSeconds(); 

是我的源代码的jsfiddle



(不知道为什么它不能在jsfiddle中工作)

无论如何,我的问题是,是否有可能在chrome调试器工具中设置一个条件断点?

解决方案

是的, 。

右键单击断点的标记并选择编辑断点...,您可以在其中设置条件。



断点上的Chrome开发者工具

a> at developers.google.com(Emphasis mine):
$ b


注意:您设置的所有断点都出现在右下角的断点下,手边栏。点击该条目跳转到源文件中突出显示的行。一旦设置了断点,右键单击蓝色标记断点指示符为该断点设置条件语句。输入一个表达式,只有当条件为真时,断点才会暂停。



I have this simple a js file , which prints date continosly .

I am using Google Chrome Debugger tools (F12)

My question is , Is it possible to set a conditional break point in Google Chrome ??

In my code , i want to set a break point if the seconds value is equal to 50 ??

s = date.getSeconds();

This is the jsfiddle where my source is

(Not sure why its not working in jsfiddle)

Anyway my question is ,Is it possible to Set a Conditinal Break Point in chrome Debugger tools ??

解决方案

Yes, it is possible.

Right click the marker of the breakpoint and select "Edit breakpoint..." there you can set the condition.

From Chrome Developer Tools on Breakpoints at developers.google.com (Emphasis mine):

Note: All the breakpoints you have set appear under Breakpoints in the right-hand sidebar. Clicking on the entry jumps to the highlighted line in the source file. Once you have a breakpoint set, right click on the blue tag breakpoint indicator to set a conditional statement for that breakpoint. Type an expression and the breakpoint will only pause only if the condition is true.

这篇关于JavaScript:如何在Chrome调试器工具中设置条件断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆