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:
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 callednam.
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
- Read the error message, slowly.
- Find the line it mentions.
- Guess what's wrong, then change one thing.
- Run again. Repeat.
Now go squash three bugs in the practice below. 🐛
🧪 Practice: 3 steps
0 / 3 doneStep 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.
Output appears here. Press Run or Ctrl/⌘ + Enter.
Step 2 of 3 · The typo
This one has a spelling mistake. Run it, read the error, and fix it so it prints 42.
Output appears here. Press Run or Ctrl/⌘ + Enter.
Step 3 of 3 · The missing bracket
Last one. Run it, read the error, and fix it so it prints Bug squashed!.
Output appears here. Press Run or Ctrl/⌘ + Enter.
✅ Check your understanding
You see a red error. What should you do first?
What does `ReferenceError: totl is not defined` most likely mean?
Create a free account to track your progress.