0Pricing
Javascript for Kids · Lesson

Showing the Score

Print the total.

Showing the Score 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.

Show Off the Score! 📺

What good is a score if nobody can see it? Time to display the total in fun ways! 🎉

Print the Score 🖨️

The simplest way: console.log the score!

let score = 7
console.log(score)

Add a Friendly Label 🏷️

Just a number is boring. Add words so the player knows what it means!

let score = 7
console.log("Your score: " + score)

Joining Words and Numbers 🔗

Use + to glue text and the score together into one message.

let score = 7
console.log("You have " + score + " points! 🌟")

Show Score and Name 👤

Make it personal! Show the player name with the score.

let name = "Sam"
let score = 12
console.log(name + " has " + score + " points!")

Score Out of Total ➗

Show how the player is doing compared to the max. Like "8 out of 10"!

let score = 8
let max = 10
console.log("Score: " + score + " / " + max)

A Show Score Function 🛠️

Make a helper that displays the score nicely. Use it whenever you need!

function showScore(score) {
  console.log("Current score: " + score + " 🎯")
}
showScore(15)

Score Bar with Stars ⭐

Turn the score into stars for a fun picture! A loop repeats the star.

let score = 4
let bar = ""
for (let i = 0; i < score; i++) {
  bar += "⭐"
}
console.log(bar)

A Winning Message 🏆

Show a special message if the score is high!

let score = 10
if (score >= 10) {
  console.log("🏆 High score! You are a champion!")
}
console.log("Score: " + score)

Update the Score Display 🔄

Every time the score changes, show it again so it stays fresh!

let score = 0
score += 5
console.log("Score: " + score)
score += 3
console.log("Score: " + score)

The Scoreboard Shines! ✅

You can now show the score with labels, names, stars, and cheers. Your score keeper is complete! 🎉

let name = "Lee"
let score = 9
console.log("🎮 " + name + ": " + score + " points!")

Quick Check ❓

The final brain teaser! 🧠

Display Champion! 🏆

You finished Simple Score Keeper! Recap:

  • 🖨️ Print the score
  • 🏷️ Add friendly labels
  • ⭐ Show stars with a loop
  • 🏆 Cheer for high scores

You built a full score keeper! Amazing! 🌟

Frequently asked questions

Is the “Showing the Score” lesson free?

Yes — the full text of “Showing the Score” 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 “Showing the Score”?

Print the total. 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 “Showing the Score” 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. Starting at Zero
  2. Adding Points
  3. Losing Points
  4. Showing the Score
← Back to Javascript for Kids