Breakpoints
Errors and logs are useful, but the most powerful method of debugging is through breakpoints. Setting breakpoints lets you pause the execution of your code on a particular line in your program. When the code is paused, you can inspect the current value of all the variables. You can execute the instructions after the breakpoint one at a time to see which instructions get executed and how the values of your variables change. Breakpoints let you slow things down to see exactly what is going on when your code is executed.
You set a breakpoint in two ways using the Chrome Developer Tools. The first and easiest way is to put a debugger statement in your code. The debugger has no effect on the rest of your code, but it pauses the code at ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access