Week 7: Build a Quiz That Recommends Something

This week in plain English

ObjectiveCreate an interactive quiz that asks questions, tracks answers and gives a recommendation.
Why this mattersQuizzes are used commercially to guide visitors toward products, services or next steps.
What she will makeA quiz that recommends one of three options.
What “done” looks likeThe quiz asks questions, records answers and shows a recommendation at the end.
At the end, she should be able to say:
“A quiz can collect choices and use simple logic to recommend something.”
Fortnight project: Commercial Project 4 starts: Quiz / Recommendation Tool.

Skills: arrays, buttons, score tracking, recommendation logic, DOM updates

Suggested session structure: 10 minutes objective, 10 minutes ChatGPT planning, 25 minutes building, 10 minutes testing, 5 minutes recap.

Commercial objective for Weeks 7–8

Two-week commercial outcome: Build a recommendation quiz, such as “Which safety kit suits you?” or “Which website tool should you build first?”

Step-by-step

  1. Create recommendation-quiz.html.
  2. Choose three possible recommendations.
  3. Write five questions.
  4. Use ChatGPT to help turn questions into JavaScript data.
  5. Show one question at a time.
  6. Track points for each recommendation.
  7. Show the top recommendation.

ChatGPT prompt

Prompt:
I want to build a beginner JavaScript recommendation quiz. Topic: Which kids safety kit should you choose? Options: Home Safety Kit, Outdoor Safety Kit, Online Safety Kit. Please create 5 simple questions and explain how the scoring could work.

Simple scoring idea

const scores = {
  home: 0,
  outdoor: 0,
  online: 0
};

// If the user picks an answer about locks or alarms:
scores.home++;

// If the user picks an answer about walking or parks:
scores.outdoor++;

// If the user picks an answer about passwords or devices:
scores.online++;

Recommendation result idea

function getRecommendation() {
  if (scores.home >= scores.outdoor && scores.home >= scores.online) {
    return "Home Safety Kit";
  }

  if (scores.outdoor >= scores.home && scores.outdoor >= scores.online) {
    return "Outdoor Safety Kit";
  }

  return "Online Safety Kit";
}

End of week check

  • The quiz has at least five questions.
  • Each answer adds to a score.
  • The quiz shows a recommendation.
  • The recommendation makes sense.