Apcsp PC
Apcsp PC
// returns the count of how many of the user's inputted answer on the
quiz matches up with the answer entered for the question
// answersList {string} the name of the list of the user's answers for
the quiz
// return {number} the amount of questions answered right on the quiz
function gradeQuiz(answersList) {
correctCount = 0;
for (var i = 0; i < answersList.length; i++) {
if (answersList[i].toLowerCase() === answers[i].toLowerCase()) {
correctCount++;
}
}
setText("text", "You got " + correctCount + " out of " +
numQuestions + " questions correct!");
setScreen("result");
}