← Back to project

To save as PDF: File → Print → Save as PDF (set margins to None)

STEMigoo
Build a JavaScript Quiz App
💻 Technology

Build a JavaScript Quiz App

Write your first interactive web app — a multiple-choice quiz that keeps score and shows results — using HTML, CSS, and plain JavaScript with no frameworks needed. Ages 12+.

You'll learn

1 How HTML, CSS, and JavaScript work together in a browser
2 DOM manipulation: selecting elements and changing their content with JavaScript
3 Arrays of objects, loops, and conditionals in JavaScript
4 Event listeners and how user interactions trigger code
2–4 hrs · Intermediate · Ages 12+ · Free
💻 Technology

Build a JavaScript Quiz App

🎯 Intermediate ⏱ 2–4 hrs 👤 Ages 12+ 💰 Free
Build a JavaScript Quiz App

What You Need

  • Computer with a browser (Chrome or Firefox recommended) (~Already own)
  • Text editor (VS Code is free at code.visualstudio.com) (~Free)
  • Notepad with 10 quiz questions and answers (~Already own)

Steps

  1. Write your quiz questions — Before touching code, write out 10 questions on paper. For each question, write four answer options and mark the correct one. Keep questions on a single topic you know well — science, movies, geograp…
  2. Set up the HTML structure — Paste this starter HTML into your index.html file and fill in the page title with your quiz name. The structure needs: a heading for the question text, four buttons for answers, a div showing current…
  3. Build the questions array in JavaScript — Add a <script> tag at the bottom of your HTML, just before </body>. Inside it, create a JavaScript array called questions. Each element of the array is an object with three properties: question (the …
  4. Write the display and answer logic — Write a function called showQuestion(index) that: gets the question object at questions[index], sets the question element's textContent to the question string, and loops through the four answer butto…
  5. Add the results screen and test everything — When currentIndex reaches questions.length (the end of the array), instead of calling showQuestion, hide the quiz container and show the results div. Display the final score as text: "You got 7 out o…

My Observations

Date: _____________   Location: _______________________

My Sketch / Results

What surprised me most:

I would change: