script.js
//Checks user's answers against the correct answers.
Checks user's answers against the correct answers.
Checks user ' s answers against the correct answers .
function checkAnswer(event) {
    var element = event.target;
    if (element.textContent === quiz[index].answer) {
        score++;
        alert("Correct! Your score is: " + score);
        startQuiz(1);
    } else {
        alert("Incorrect! You've been penalized 10 seconds!");
        currentTimer -= 10;
        startQuiz(1);
    }
    if (index > quiz.length - 1) {
        init();
    }
}
function checkAnswer ( event ) { var element = event . target ; if ( element . textContent === quiz [ index ] . answer ) { score ++ ; alert ( "Correct! Your score is: " + score ) ; startQuiz ( 1 ) ; } else { alert ( "Incorrect! You've been penalized 10 seconds!" ) ; currentTimer -= 10 ; startQuiz ( 1 ) ; } if ( index > quiz . length - 1 ) { init ( ) ; } }
Checks user's answers against the correct answers.
Checks user ' s answers against the correct answers .