Debug JavaScript

Kayce Basques
Kayce Basques
Sofia Emelianova
Sofia Emelianova

This tutorial teaches you the basic workflow for debugging any JavaScript issue in DevTools. Read on, or watch the video version of this tutorial.

Reproduce the bug

Finding a series of actions that consistently reproduces a bug is always the first step to debugging.

  1. Open this demo in a new tab.
  2. Enter 5 in the Number 1 box.
  3. Enter 1 in the Number 2 box.
  4. Click Add Number 1 and Number 2. The label below the button says 5 + 1 = 51. The result should be 6. This is the bug you're going to fix.