The Detective's Toolkit

Instead of writing hundreds of console.log statements, use the built-in Debugger in Chrome DevTools — it's 10x more powerful and faster.

Core Techniques

1. Breakpoints

Click any line number in the Sources panel — execution will freeze at that line, letting you inspect the full state of your program.

2. The debugger Statement

Write debugger; directly in your code — the browser pauses there automatically (only when DevTools is open):

function calculateTotal(items) {
  debugger; // Execution pauses here!
  return items.reduce((sum, item) => sum + item.price, 0);
}

3. Conditional Breakpoints

Right-click a line number → " Add conditional breakpoint " → only pauses when your condition is true (e.g., i === 500 in a loop of 1000).

Navigation Controls

KeyAction
F8Continue to next breakpoint
F10Step over (execute next line, skip into functions)
F11Step into (enter the called function)
Shift+F11Step out (finish current function, return to caller)
Tip

The Debugger lets you " travel through time, " inspecting the program's state at every single step. This is far faster than any console.log approach.