Make the multi-subject quiz work correctly!
- Change the
?
in theif
/else
statement for the English question so that it checks for the correct answer, which is Mon - Add an
if
/else
statement for the Math question so that it prints “Correct!” if the answer is 30, and “Wrong! Try again” otherwise. - Add an
if
/else
statement for the Social Studies question so that it prints “Correct!” if the answer is Albany, and “Wrong! Try again” otherwise. - Add a click handler with an
if
/else
statement for the Science question so that it checks for the answer solid.
Make it so that each question turns green if you get it right, and red if you get it wrong.
You’ll notice that your four click handlers all contain pretty similar code. Write a function called checkAnswer()
that is given the correct answer, along with selectors for the relevant <div>
s, and does the right thing for all four questions.