For each of the test questions, use conditionals to check whether the correct answer was provided by the user. The click handlers for each question has been provided for you (except for the last question).
Go through each question, and do the following:
-
** English **: Write an
if/else
conditional statement to check if the value of the variableenglishInput
is correct (the answer should beMon
). -
** Social Studies **: Write an
if/else
conditional statement to check if the value of the variablessInput
is correct (the answer should beAlbany
). If it is correct, use.text()
to display a message in the div with the IDssMessage
. (Hint: refer to the code in the previous question) -
** Math **: Write an
if/else
conditional statement to check if the value of the variablemathInput
is correct (the answer should be the number30
). If it is correct, use.text()
to display a message in the div with the IDmathMessage
. -
Science: Write a click handler for the button in the science question (refer to the HTML for the ID of the button). Create a variable that stores the value of the input in the science question. Then write an
if/else
conditional statement to check if the value of the variable you created is the correct answer (the answer issolid
). If it is correct, use.text()
to display a message in the div with the IDscienceMessage
. (Hint: refer to the code in the previous questions for guidance)
When a student gets the answer right, make it so their answer turns green. If they get it wrong, make their answer turn red.