0Pricing
Javascript for Kids · Lesson

Checking Answers

Compare answers.

Checking Answers is a free Javascript for Kids lesson on CoddyKit — lesson 2 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.

Is It Correct? 🤔

A quiz needs to know if the player got it right or wrong! Let's learn how to check. ✅❌

console.log('Let us check some answers! 🤔')

The Equals Check ⚖️

To compare two things we use === (three equal signs). It asks: are these the SAME? ⚖️

console.log(5 === 5)
console.log(5 === 8)

True and False 🟢🔴

The computer answers with true 🟢 or false 🔴. That's how it tells right from wrong!

let correct = 7
let guess = 7
console.log(guess === correct)

Check a Math Answer ➕

Let's see if a guess matches the real answer to 3 + 4! ➕

let answer = 3 + 4
let guess = 7
console.log('Did they get it right?', guess === answer)

Using IF 🚦

With if we can do something special when the answer is correct! 🚦

let answer = 6
let guess = 6
if (guess === answer) {
  console.log('Correct! 🎉')
}

IF and ELSE 🔀

else tells the computer what to do when the answer is WRONG. 🔀

let answer = 10
let guess = 4
if (guess === answer) {
  console.log('Correct! 🎉')
} else {
  console.log('Oops, try again! ❌')
}

Show the Right Answer 💡

When players are wrong, it's kind to show them the right answer! 💡

let answer = 12
let guess = 9
if (guess === answer) {
  console.log('Correct! 🎉')
} else {
  console.log('Nope! The answer was', answer)
}

Check Many Answers 📋

We can check more than one question, one after another! 📋

let g1 = 4
let g2 = 9
console.log('Q1 right?', g1 === 4)
console.log('Q2 right?', g2 === 10)

Make a Checker Function 🛠️

A function is a reusable helper. Let's build a checker we can use again and again! 🛠️

function check(guess, answer) {
  if (guess === answer) {
    console.log('Correct! 🎉')
  } else {
    console.log('Wrong! ❌')
  }
}
check(5, 5)
check(3, 8)

Watch Out for Type! 🧐

The number 7 and the text '7' are NOT the same to a computer. === checks both value AND type! 🧐

console.log(7 === 7)
console.log(7 === '7')

Full Answer Check 🎮

Here is a complete answer check for one quiz question! 🎮

let answer = 6 + 6
let guess = 12
if (guess === answer) {
  console.log('You got it! ⭐')
} else {
  console.log('Almost! It was', answer)
}

Quick Check ✅

Show what you know! 🧠

Great Job! 🌟

You can now check answers like a pro! 🎉

  • === compares values ⚖️
  • if/else handles right vs wrong 🔀
  • Functions make reusable checkers 🛠️

Next: keeping score! 🏆

console.log('Answer checking: DONE! 🌟')

Frequently asked questions

Is the “Checking Answers” lesson free?

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

Compare answers. 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 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Checking Answers” 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. Making Questions
  2. Checking Answers
  3. Keeping Score
  4. Final Score
← Back to Javascript for Kids