script.js
//Starts quiz and cycles through quiz array
Starts quiz and cycles through quiz array
Starts quiz and cycles through quiz array
function startQuiz(direction) {
    index += direction;
    currentQuestion.textContent = "";
    optionsUl.innerHTML = "";
    optionsUl.style.listStyleType = "none";
    currentQuestion.textContent = quiz[index].question;
    userChoices = quiz[index].choices;
    userChoices.forEach(function (option) {
        var optionsLi = document.createElement("li");
        optionsLi.style.padding = "10px";
        var optionBtn = document.createElement("button");
        optionBtn.style.width = "200px";
        optionBtn.style.wordWrap = "break-word";
        optionBtn.style.border = "5px outset white";
        optionsLi.appendChild(optionBtn);
        optionBtn.textContent = option;
        optionsDiv.appendChild(optionsUl);
        optionsUl.appendChild(optionsLi);
        optionsLi.addEventListener("click", (checkAnswer));
    });
}
function startQuiz ( direction ) { index += direction ; currentQuestion . textContent = "" ; optionsUl . innerHTML = "" ; optionsUl . style . listStyleType = "none" ; currentQuestion . textContent = quiz [ index ] . question ; userChoices = quiz [ index ] . choices ; userChoices . forEach ( function ( option ) { var optionsLi = document . createElement ( "li" ) ; optionsLi . style . padding = "10px" ; var optionBtn = document . createElement ( "button" ) ; optionBtn . style . width = "200px" ; optionBtn . style . wordWrap = "break-word" ; optionBtn . style . border = "5px outset white" ; optionsLi . appendChild ( optionBtn ) ; optionBtn . textContent = option ; optionsDiv . appendChild ( optionsUl ) ; optionsUl . appendChild ( optionsLi ) ; optionsLi . addEventListener ( "click" , ( checkAnswer ) ) ; } ) ; }
Starts quiz and cycles through quiz array
Starts quiz and cycles through quiz array