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:
Introduction:
Explain the objective to the user. Use alert to introduce the quiz and prompt to start the quiz.
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.
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.
Conclusion: Display the result to the user using alert, telling them what their spirit animal is and a fun fact about it.
Requirements:
Employ nested IF statements for decision-making based on user inputs.
Use prompt for getting inputs from the user.
Use alert for displaying messages and outcomes.
Avoid using loops, custom functions, or DOM manipulation.
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
andalert
.Instructions:
Introduction: Explain the objective to the user. Use
alert
to introduce the quiz andprompt
to start the quiz.Questions:
Determine Spirit Animal:
Conclusion: Display the result to the user using
alert
, telling them what their spirit animal is and a fun fact about it.Requirements:
prompt
for getting inputs from the user.alert
for displaying messages and outcomes.