Skip to content

Instantly share code, notes, and snippets.

@p01 p01/quack.js
Created Jan 12, 2014

Embed
What would you like to do?
Conditional breakpoint after X iterations of a loop
// 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
You can’t perform that action at this time.