Created
January 12, 2014 16:11
-
-
Save p01/8386586 to your computer and use it in GitHub Desktop.
Conditional breakpoint after X iterations of a loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example of conditional breakpoint ( in code ) after X iterations | |
for(var i=0, __iterations_left_before_break=50; (--__iterations_left_before_break||debugger),i<1e5;i++) | |
{ | |
// body of the loop | |
} | |
/* | |
To do the same in devtool, you can put a breakpoint on the first statement of the loop, | |
right-click on the breakpoint > Edit condition. | |
Write an expression that is truthy when you want to break, and falsy otherwise. | |
Be wary of trailing semicolon on the condition as it would behave as if followed by an | |
empty statement and thus never break ;) | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment