function correctClick() {
    if (answerText == questions[index].answer) {
        score += 10;
        index += 1;
        answerResult.textContent = "";
        if (index >= questions.length) {
            totalScore = sec + score;
            sec = 0;
        } else {
            showQuestion();
        }
    } else {
        answerResult.textContent = "Incorrect! -10 seconds!";
        sec -= 10;
    }
}
// This function will check if the clicked answer is the correct answer. If so, it will give points and show the next question. If not, the user loses time.
This function will check if the clicked answer is the correct answer. If so, it will give points and show the next question. If not, the user loses time.
This function will check if the clicked answer is the correct answer . If so it will give points and show the next question . If not the user loses time .
function correctClick() {
    if (answerText == questions[index].answer) {
        score += 10;
        index += 1;
        answerResult.textContent = "";
        if (index >= questions.length) {
            totalScore = sec + score;
            sec = 0;
        } else {
            showQuestion();
        }
    } else {
        answerResult.textContent = "Incorrect! -10 seconds!";
        sec -= 10;
    }
}
function correctClick ( ) { if ( answerText == questions [ index ] . answer ) { score += 10 ; index += 1 ; answerResult . textContent = "" ; if ( index >= questions . length ) { totalScore = sec + score ; sec = 0 ; } else { showQuestion ( ) ; } } else { answerResult . textContent = "Incorrect! -10 seconds!" ; sec -= 10 ; } }
This function will check if the clicked answer is the correct answer.
This function will check if the clicked answer is the correct answer .