0Pricing
Javascript for Kids · Lesson

Game Over

Handle losing.

Game Over! 💀

Not every choice leads to treasure! Sometimes the hero loses. We need a Game Over ending too, so the game feels real. Let us build it! 😬

When the Hero Loses 🐉

Falling in a trap or meeting a dragon can end the game. Check it with if!

let event = "dragon"
if (event === "dragon") {
  console.log("The dragon caught you! 🐉")
}

All lessons in this course

  1. Planning the Adventure
  2. Making Choices
  3. Winning
  4. Game Over
← Back to Javascript for Kids