While console.log() is commonly used for quick debugging, enterprise development requires interactive debugging using browser Developer Tools. Setting breakpoints pauses JavaScript execution, enabling you to inspect local scope variables, evaluate expressions in the console, and step through code execution line by line.
In Google Chrome, Microsoft Edge, or Firefox:
F12 or Ctrl + Shift + I (Windows/Linux) or Cmd + Option + I (Mac).Ctrl + P to quickly find and open any source file.Click directly on any line number in the source editor (a blue/orange marker appears). Execution pauses right before that line executes.
debugger; StatementPlace the debugger; statement directly in your source code. When DevTools is open, execution automatically pauses at that statement:
Right-click a line number and choose Add conditional breakpoint.... Enter an expression (e.g. userId === 99 or price > 500). Execution will pause only when that expression evaluates to true!
Right-click any HTML element in the Elements panel -> Break on ->:
Once paused, use the debugging controls:
| Button | Key | Action | Description |
|---|---|---|---|
| Resume | F8 | Continue execution | Runs until the next breakpoint or script completion |
| Step Over | F10 | Next line | Executes current line without stepping into function calls |
| Step Into | F11 | Dive inside | Steps into the function invoked on current line |
| Step Out | Shift + F11 | Jump out | Finishes current function and returns to caller |
While paused at a breakpoint:
Local, Closure, Global) and their real-time memory values.+ to monitor custom expressions (e.g., cart.items.length * taxRate) that re-evaluate at every step.Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Using console methods | Network Tab for API Calls |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.
Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.