PatrickFrankAIU / ITWEB220-2404A

Learning resources for students in ITWEB 220, term 2404A.
0 stars 0 forks source link

Challenge: Find Your Spirit Animal #11

Open PatrickFrankAIU opened 3 months ago

PatrickFrankAIU commented 3 months ago

Objective: Develop a JavaScript program that conducts a short personality quiz to determine the user's spirit animal. The quiz uses a series of questions where the user's choices lead to different outcomes, determined by nested IF statements. The exercise will reinforce the student's understanding of complex branching logic and user input/output handling with prompt and alert.

Instructions:

  1. Introduction: Explain the objective to the user. Use alert to introduce the quiz and prompt to start the quiz.

  2. Questions:

    • Question 1: Ask the user about their preferred time of day: "morning" or "night". Store their answer.
    • Question 2: Based on the first answer, ask a follow-up question:
      • If "morning", ask if they prefer "coffee" or "tea".
      • If "night", ask if they enjoy "stargazing" or "night walks".
    • Question 3: Ask a final question that depends on the previous answers to narrow down the spirit animal.
  3. Determine Spirit Animal:

    • Use nested IF statements to analyze the user's answers and determine their spirit animal.
    • There should be at least four possible outcomes.
  4. Conclusion: Display the result to the user using alert, telling them what their spirit animal is and a fun fact about it.

Requirements: