Run and Debug JavaScript

This lesson is browser-only. No Node.js setup is required for this roadmap.

Run in browser

  1. Open an HTML file in your browser.
  2. Open developer tools (F12 or Ctrl+Shift+I).
  3. Use Console for quick experiments.

Breakpoints

Open Sources panel, find your script, and click a line number to pause execution.

Inspect state

  • Watch variables in Scope panel.
  • Evaluate expressions in Console while paused.
  • Step over, step into, and step out to trace flow.

Network debugging

Use Network panel to inspect API requests, status codes, payloads, and timing.

Debug checklist

  1. Reproduce issue with minimal steps.
  2. Read console and stack traces.
  3. Set breakpoint near failure.
  4. Confirm assumptions with inspected values.
  5. Retest after fix.