Visit homepage

debugger

  • Planted:

After a few years of coding professionally, I finally tried this one line of code:

anywhere.js

debugger;

The debugger; statement sets a breakpoint in your code, pausing execution at that point if you have a step-through debugger available, like in browser devtools or VS Code.

I did already know about debuggers and have heard others swear by them, but they also are intimidating, maybe because they are so feature rich compared to the simplicity of a console.log(). You can inspect values assigned to variables, explore the call stack, step into function invocations, and even set conditional breakpoints, for example.

I've found the debugger—both the JS statement and just manually setting breakpoints in the browser—enormously helpful for navigating large, unfamiliar codebases. We maintain a fork of vscode at Membrane, and I've been leaning heavily on the debugger/breakpoints to find my way around.

Reply

Respond with your thoughts, feedback, corrections, or anything else you’d like to share. Leave your email if you’d like a reply. Thanks for reading.