function randomQuestion() {
    let randomNumber = Math.floor(Math.random() * questions.length);
    if (index == questions.length) {
        quizOver();
    } else {
        if (answeredQuestions.length > 0) {
            if (answeredQuestions.includes(randomNumber)) {
                randomQuestion();
            } else {
                currentIndex = randomNumber;
                load();
            }
        }
        if (answeredQuestions.length == 0) {
            currentIndex = randomNumber
            load()
        }
        //add the question to list of anwered questions
        answeredQuestions.push(randomNumber)
    }
}
//Function to select a random question
Function to select a random question
Function to select a random question
function randomQuestion() {
    let randomNumber = Math.floor(Math.random() * questions.length);
    if (index == questions.length) {
        quizOver();
    } else {
        if (answeredQuestions.length > 0) {
            if (answeredQuestions.includes(randomNumber)) {
                randomQuestion();
            } else {
                currentIndex = randomNumber;
                load();
            }
        }
        if (answeredQuestions.length == 0) {
            currentIndex = randomNumber
            load()
        }
        answeredQuestions.push(randomNumber)
    }
}
function randomQuestion ( ) { let randomNumber = Math . floor ( Math . random ( ) * questions . length ) ; if ( index == questions . length ) { quizOver ( ) ; } else { if ( answeredQuestions . length > 0 ) { if ( answeredQuestions . includes ( randomNumber ) ) { randomQuestion ( ) ; } else { currentIndex = randomNumber ; load ( ) ; } } if ( answeredQuestions . length == 0 ) { currentIndex = randomNumber load ( ) } answeredQuestions . push ( randomNumber ) } }
Function to select a random question
Function to select a random question
//add the question to list of anwered questions