← Prep

Lesson 4 of 4 ⏱ 5 minutes

When something isn't working

A rescue chapter. Every programmer gets stuck sometimes, even the best ones. Here's what to do.

First, the most important thing

When something isn’t working, it’s not your fault and you haven’t broken anything. Getting stuck is a completely normal part of programming. Professional programmers deal with bugs every single day: the only difference is they’ve learned to hunt them down calmly.

The golden rule: read carefully

90% of all bugs in code are typos. Computers are incredibly picky:

Compare your code to the code in the lesson letter by letter. You’ll usually find the mistake within a minute.

Common hiccups and how to fix them

”It just opens as plain text, not a page”

Your file probably isn’t named index.html, but something like index.html.txt. In VS Code, delete the file and create a new one: the name must end exactly in .html.

”I changed the code, but nothing changed on the page”

Two most common causes:

  1. You forgot to save: press Ctrl+S (Cmd+S on Mac). An unsaved file has a dot next to its name in VS Code instead of an X.
  2. You forgot to refresh the page: press F5 in your browser.

”There are weird symbols on the page instead of accented letters”

Your file’s header is missing the line <meta charset="UTF-8">. Add it between <head> and </head>: it tells the browser what character set your text uses.

”The image isn’t showing, there’s just a broken image icon”

”Suddenly half the page is bold / huge / blue”

Somewhere you forgot a closing tag. For example, <strong> is missing its </strong>, so everything stays bold all the way to the end. Find where the weirdness starts and add the missing closing tag.

When you’re still stuck

  1. Take a break. Seriously. Five minutes staring out the window and the bug often finds itself. Even the pros do this.

  2. Read the broken part out loud. Sounds silly, but it works: reading out loud makes you notice things your eyes tend to skip.

  3. Ask for a second pair of eyes. A parent, sibling, friend: they don’t need to know how to code, they just need to compare your code with the lesson.

  4. Start a small part over. When it’s all too much, delete the last part you added, check that the page works again, then add it back, more slowly this time.

💡

Remember: every bug you fix makes you a better programmer. Debugging isn’t a chore, it’s a superpower you’re building right now.