Lesson 5 of 6 · 10 min · 3 hands-on steps

Errors Are Your Friends: Fixing Your First Bugs

Every error message tells you what's wrong. Learn to read them, then fix three real bugs.

Every developer sees errors all day

Here's a secret: professional developers see error messages constantly. An error isn't a sign you're bad at this. It's the computer telling you exactly what it needs.

Run this example. It's broken on purpose:

JavaScript · try it
Loading…

Read the error from left to right:

  • ReferenceError: the type of problem. Here, a name the computer doesn't recognize.
  • nam is not defined: the details. There's no variable called nam.

On this site, a 💡 box under each error explains it in plain English. Over time you'll start reading errors yourself without help. That's a superpower.

The three most common beginner bugs

Bug What you'll see Fix
Missing quote Invalid or unexpected token Put a " at both ends of the text
Typo in a name xyz is not defined Check spelling and capital letters
Missing bracket missing ) after argument list Every ( needs a )

Your debugging routine

  1. Read the error message, slowly.
  2. Find the line it mentions.
  3. Guess what's wrong, then change one thing.
  4. Run again. Repeat.

Now go squash three bugs in the practice below. 🐛

🧪 Practice: 3 steps

0 / 3 done

Step 1 of 3 · The missing quote

Press Run tests ▶ and read the red error. The 💡 box under it explains what it means in plain English.

Then fix the bug so it prints I can do this.

JavaScript
Loading editor…

Output appears here. Press Run or Ctrl/⌘ + Enter.

✅ Check your understanding

  1. You see a red error. What should you do first?

  2. What does `ReferenceError: totl is not defined` most likely mean?

Create a free account to track your progress.