0Pricing
Javascript for Kids · Lesson

You Got It!

Win the game.

You Got It! is a free Javascript for Kids lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Javascript for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Victory Time! 🏆

The player guessed the animal! Now we make a BIG, happy celebration. 🎉🎊 Let us learn how to win the game!

A Winning Message 🎉

When they win, shout it out! A loud, happy message makes the player smile. 😄

console.log("🎉 YOU GOT IT! 🎉")
console.log("The animal was a lion! 🦁")

Show the Animal Name 🏷️

Reveal the secret name so they know what they guessed!

let secret = "penguin"
console.log("Amazing! It was a " + secret + "! 🐧")

Counting the Guesses 🔢

Did they win in 1 try or 5? Let us tell them their score!

let tries = 3
console.log("You won in " + tries + " guesses! 🌟")

Fewer Guesses = Better! ⭐

Reward fast players with extra praise using if.

let tries = 1
if (tries === 1) {
  console.log("WOW! First try! You are a genius! 🤩")
} else {
  console.log("Great job! 👏")
}

Stars for the Player ⭐⭐⭐

Give stars based on how fast they won. The fewer tries, the more stars!

let tries = 2
if (tries <= 2) {
  console.log("⭐⭐⭐ Three stars!")
} else {
  console.log("⭐ One star, nice!")
}

A Celebrate Function 🛠️

Build a helper that celebrates any win. Reuse it for every round!

function celebrate(animal, tries) {
  console.log("You found the " + animal + " in " + tries + " tries! 🎉")
}
celebrate("frog", 2)

Play Again? 🔁

Great games let you play again! Ask the player if they want another round.

let playAgain = true
if (playAgain) {
  console.log("Let us play again! 🔄")
}

Keeping a High Score 🥇

Remember the BEST score so players can try to beat it!

let bestScore = 5
let thisGame = 3
if (thisGame < bestScore) {
  bestScore = thisGame
  console.log("New best score: " + bestScore + "! 🥇")
}

A Final Cheer 📣

End with a big thank-you. Happy players come back to play more! 💖

console.log("Thanks for playing! 🐾")
console.log("Come back soon, Animal Detective! 🕵️")

The Game is Complete! ✅

You built a whole game: a list, clues, checking, and winning! You are a real coder now. 🚀

function win(animal, tries) {
  console.log("🎉 You got the " + animal + " in " + tries + " tries!")
  console.log("You are awesome! ⭐")
}
win("lion", 1)

Quick Check ❓

Last brain teaser of the game! 🧠

Game Champion! 🏅

You finished the Guess the Animal Game! Recap:

  • 🎉 Show a winning message
  • 🔢 Count guesses for a score
  • ⭐ Give stars with if
  • 🛠️ Use a celebrate function

You are officially a game maker! 🎮

Frequently asked questions

Is the “You Got It!” lesson free?

Yes — the full text of “You Got It!” is free to read here on the web, and the Javascript for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Javascript for Kids course, upgrade to CoddyKit PRO.

What will I learn in “You Got It!”?

Win the game. You practise Javascript for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Javascript for Kids?

No prior experience is required. Javascript for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “You Got It!” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Javascript for Kids lesson?

Yes. Every Javascript for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. A List of Animals
  2. Giving Clues
  3. Checking Guesses
  4. You Got It!
← Back to Javascript for Kids