Conditional Breakpoints
These allows to break at a particular line only if a specific condition is evaluated to be true.
The condition can include any variable in code that is available at that particular line. Even the variables inside the closures can be accessed in the condition evaluation.
Try
- Open Sources tab with file
2-conditional-breakpoint.js
- Right-click on the line number and add a conditional breakpoint inside
dataProcessor()
function - Add condition
index > 3
in debugger window - Click on the button to trigger a loop. Note that the breakpoint starts hitting only after 1.5 seconds once the value of
index
is 3 or more