Stop Using console.log for Debugging
console.log is fine. But leaning on it exclusively is leaving a lot of productivity on the table. Here are three better approaches I now use daily.
1. The Node.js Debugger (and VS Code’s Debug Panel)
Most developers don’t know Node ships with a built-in inspector. Run your script with --inspect-brk and attach VS Code’s debugger, or open chrome://inspect in Chrome. You get breakpoints, watch expressions, call stacks, and the ability to step through code line by line. It sounds fancy but takes about 60 seconds to set up.
2. console.table
When you’re logging arrays of objects, swap console.log for console.table. It renders a proper table in the terminal/console with columns for each key. Dramatically easier to scan than [Object, Object, Object].
console.table(users); // instead of console.log(users)
3. Conditional Breakpoints
In any modern browser or VS Code, you can right-click a breakpoint and add a condition. The debugger only pauses when the condition is true — invaluable when you’re debugging something that only happens on the 500th iteration of a loop.
Logging has its place, but learning your debugger is one of the highest-leverage investments you can make as a developer.
About
Network Entropology (n.): The study of chaos in data network systems; the discipline concerned with understanding how order degrades, complexity accumulates, and entropy propagates across connected infrastructure, and the practice of bringing order back to it. A field that exists whether or not its practitioners know they are in it.