function nextQuestion(index) {
    //If all questions have been answered, the quiz ends
    if (index < questionArr.length) {
        headerDisplay.textContent = questionArr[index];
        headerDisplay.style.fontSize = "30px";
        pText.textContent = "";
        btnClick.style.display = "none";
        answersEl.textContent = "";
        //Change this block to loop through an array containing arrays

        //Index is the indicator for the question and answer set
        //So I want to access answerArr[index] and render the answers
        //Create buttons
        for (let i = 0; i < answerArr[index].length; i++) {
            const liEl = document.createElement("li");
            const currentAnswers = answerArr[index];
            const buttonToo = document.createElement("button");
            buttonToo.textContent = i + 1 + ". " + currentAnswers[i];

            buttonToo.setAttribute("class", "btnFlavor")


            liEl.appendChild(buttonToo);
            answersEl.appendChild(liEl);
        }
    } else {
        gameOver();
    }
}
//Clear the previous screen and post the next question with answers
Clear the previous screen and post the next question with answers
Clear the previous screen and post the next question with answers
function nextQuestion(index) {
    if (index < questionArr.length) {
        headerDisplay.textContent = questionArr[index];
        headerDisplay.style.fontSize = "30px";
        pText.textContent = "";
        btnClick.style.display = "none";
        answersEl.textContent = "";
        for (let i = 0; i < answerArr[index].length; i++) {
            const liEl = document.createElement("li");
            const currentAnswers = answerArr[index];
            const buttonToo = document.createElement("button");
            buttonToo.textContent = i + 1 + ". " + currentAnswers[i];
            buttonToo.setAttribute("class", "btnFlavor")
            liEl.appendChild(buttonToo);
            answersEl.appendChild(liEl);
        }
    } else {
        gameOver();
    }
}
function nextQuestion ( index ) { if ( index < questionArr . length ) { headerDisplay . textContent = questionArr [ index ] ; headerDisplay . style . fontSize = "30px" ; pText . textContent = "" ; btnClick . style . display = "none" ; answersEl . textContent = "" ; for ( let i = 0 ; i < answerArr [ index ] . length ; i ++ ) { const liEl = document . createElement ( "li" ) ; const currentAnswers = answerArr [ index ] ; const buttonToo = document . createElement ( "button" ) ; buttonToo . textContent = i + 1 + ". " + currentAnswers [ i ] ; buttonToo . setAttribute ( "class" , "btnFlavor" ) liEl . appendChild ( buttonToo ) ; answersEl . appendChild ( liEl ) ; } } else { gameOver ( ) ; } }
Clear the previous screen and post the next question with answers
Clear the previous screen and post the next question with answers
//If all questions have been answered, the quiz ends //Change this block to loop through an array containing arrays //Index is the indicator for the question and answer set //So I want to access answerArr[index] and render the answers //Create buttons