While working on my JS quiz, I encountered an issue where some answers were not displaying due to quotes and the need to escape HTML characters. Additionally, I am facing difficulty in accurately awarding points or deductions based on user responses. Currently, the code is marking every answer as incorrect.
Quiz.prototype.guess = function (answer) {
if(this.getQuestionIndex().isCorrectAnswer(answer)) {
right.innerHTML = "Correct!";
this.score += 10;
} else if (!this.getQuestionIndex().isCorrectAnswer(answer)) {
right.innerHTML = "Incorrect!";
wrongTimer();
}
this.questionIndex++;
}
If the user selects the correct answer, they receive 10 points. However, if they choose the wrong answer, 10 seconds are deducted from the timer.