ProjectsExtra· 120 min read

Project: Quiz App

Build a multiple-choice quiz that scores the user — logic, events and the DOM working together.

What you will learn

  • Store questions as an array of objects
  • Render questions and handle answers
  • Track and display a score

The brief

Build a small quiz: store questions as an array of objects, show each one, let the user answer, and show their final score.

  • Store questions as objects: { question, options, answer }.
  • Display the current question and its option buttons.
  • When an option is clicked, check it against the answer and update the score.
  • At the end, show the final score out of total.

Here is the same plan as the ordered steps to build it in:

  1. Set up your data: make an array of question objects, each shaped { question, options, answer }, and a score starting at 0.
  2. Track position: keep a current index (starting at 0) for which question is showing.
  3. Render the current question: read questions[current] and show its question text plus one button per item in options.
  4. Handle the answer: when an option button is clicked, compare it with that question’s answer; if it matches, add 1 to score.
  5. Move on: increase current by 1 and render the next question — or, if there are no more, show the result.
  6. Show the result: when current reaches the end, display the final score out of the total number of questions.

Tip: This project cements arrays of objects, map, events and DOM updates — exactly the data-and-render pattern you will use in React.

Note: Start simple (one question working end-to-end), then loop to the next. Build incrementally — get one thing working before adding the next.

✍️ Practice

  1. Build a 3-question quiz that tracks and shows the score.
  2. Add a “Restart” button that resets the quiz.

🏠 Homework

  1. Add a timer, or load the questions from a JSON file with fetch.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →