PatrickFrankAIU / ITWEB220-2404A

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

Challenge: JavaScript Quiz #12

Open PatrickFrankAIU opened 3 months ago

PatrickFrankAIU commented 3 months ago

For this exercise, create a simple JavaScript quiz that will ask the user a series of questions. This quiz will utilize nested IF statements to determine the next question based on the user's previous answer. The focus will again be on using prompt for input and alert for output, with branching logic to navigate through the quiz.

Objective: Create a short quiz that tests the user's knowledge of JavaScript basics. The quiz will adapt the next question based on the user's answer to the current question, using nested IF statements for this logic.

Instructions:

  1. Question 1: Start the quiz by asking the user about the correct syntax for creating a function in JavaScript. Provide two options and ask them to choose.

    • If the user selects the correct answer, congratulate them and move to question 2.
    • If the user selects the wrong answer, provide a brief explanation and end the quiz.
  2. Question 2 (for those who got question 1 correct):

    • Ask about the type of value NaN represents in JavaScript.
      • If the user answers correctly, congratulate them and proceed to the next question.
      • If the user answers incorrectly, explain what NaN represents and end the quiz.
  3. Question 3 (for those who got question 2 correct):

    • Quiz the user on what the === operator does in JavaScript.
      • If the user answers correctly, congratulate them for completing the quiz.
      • If the user answers incorrectly, provide the correct explanation.
  4. Conclusion: Regardless of the number of correct answers, congratulate the user on their effort and encourage them to study JavaScript further.