0Pricing
Javascript for Kids · Lesson

Quiz Questions

Store questions.

Quiz Questions is a free Javascript for Kids lesson on CoddyKit — lesson 1 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.

Welcome to the Quiz Show! 🎤

Lights! Camera! Action! We are building our very own Quiz Show! 🎉 First, we need questions for our players. Let us store them!

One Question, One Answer ❓

A quiz question needs the question AND the correct answer. We can keep them together in an object.

let q = { question: "What color is the sky?", answer: "blue" }
console.log(q.question)

Reading the Answer 🔑

We can peek at the correct answer too. (But we keep it secret from the player!) 🤫

let q = { question: "2 + 2 = ?", answer: "4" }
console.log("Answer is:", q.answer)

Many Questions in a List 📝

A quiz needs LOTS of questions! Put many question objects into a list.

let quiz = [
  { question: "Sky color?", answer: "blue" },
  { question: "Grass color?", answer: "green" }
]
console.log("We have " + quiz.length + " questions!")

Grabbing One Question 👆

Use the index to grab a single question from the list. Remember, counting starts at 0!

let quiz = [
  { question: "Sky color?", answer: "blue" },
  { question: "Grass color?", answer: "green" }
]
console.log(quiz[0].question)

Adding Choices 🅰️🅱️

Make it multiple choice! Add a list of options to each question.

let q = {
  question: "What says moo?",
  options: ["dog", "cow", "cat"],
  answer: "cow"
}
console.log(q.options)

Showing the Options 📋

Print each choice so the player can pick. Loop through the options!

let options = ["dog", "cow", "cat"]
for (let i = 0; i < options.length; i++) {
  console.log((i + 1) + ". " + options[i])
}

Adding a New Question ➕

Use .push() to add a brand new question to the end of the list!

let quiz = [{ question: "Sky color?", answer: "blue" }]
quiz.push({ question: "Snow color?", answer: "white" })
console.log("Now we have " + quiz.length + " questions!")

A Fun Quiz Topic 🦕

Make your quiz about something YOU love! Dinosaurs, space, animals... anything!

let quiz = [
  { question: "Biggest planet?", answer: "Jupiter" },
  { question: "Closest star to Earth?", answer: "the Sun" }
]
console.log(quiz[1].question)

Counting Total Questions 🔢

Always know how many questions you have. It helps build the score later!

let quiz = [
  { question: "A?", answer: "1" },
  { question: "B?", answer: "2" },
  { question: "C?", answer: "3" }
]
console.log("Total: " + quiz.length + " questions 🎯")

Questions Are Ready! ✅

Awesome! You have a list of quiz questions with answers and choices. The quiz show has its content! 📺

let quiz = [
  { question: "What says woof?", options: ["dog", "cat"], answer: "dog" }
]
console.log("Question: " + quiz[0].question)

Quick Check ❓

Quiz time about quizzes! 🤓

Question Master! 🏅

Recap! You learned to:

  • ❓ Store a question in an object
  • 📝 Keep many questions in a list
  • 🅰️ Add multiple choice options
  • ➕ Add questions with .push()

Next: asking them in order! 🔁

Frequently asked questions

Is the “Quiz Questions” lesson free?

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

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

How long does the “Quiz Questions” 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. Quiz Questions
  2. Asking in Order
  3. Scoring
  4. The Final Score
← Back to Javascript for Kids