assets/js/script.js
//Create a function that uses an id variable to replace the former question with the next question's text from the myQuestions array above
Create a function that uses an id variable to replace the former question with the next question's text from the myQuestions array above
Create a function that uses an id variable to replace the former question with the next question ' s text from the myQuestions array above
function questionLoop(id) {
    console.log("id: ", id)
    answer1El.style.backgroundColor = "#ffffff";
    answer2El.style.backgroundColor = "#ffffff";
    answer3El.style.backgroundColor = "#ffffff";
    answer4El.style.backgroundColor = "#ffffff";
    resultEl.textContent = "";
    questionEl.textContent = myQuestions[id].q;
    answer1El.textContent = myQuestions[id].a[0].text;
    answer2El.textContent = myQuestions[id].a[1].text;
    answer3El.textContent = myQuestions[id].a[2].text;
    answer4El.textContent = myQuestions[id].a[3].text;
    answer1El.value = myQuestions[id].a[0].correct;
    answer2El.value = myQuestions[id].a[1].correct;
    answer3El.value = myQuestions[id].a[2].correct;
    answer4El.value = myQuestions[id].a[3].correct;
    return;
}
function questionLoop ( id ) { console . log ( "id: " , id ) answer1El . style . backgroundColor = "#ffffff" ; answer2El . style . backgroundColor = "#ffffff" ; answer3El . style . backgroundColor = "#ffffff" ; answer4El . style . backgroundColor = "#ffffff" ; resultEl . textContent = "" ; questionEl . textContent = myQuestions [ id ] . q ; answer1El . textContent = myQuestions [ id ] . a [ 0 ] . text ; answer2El . textContent = myQuestions [ id ] . a [ 1 ] . text ; answer3El . textContent = myQuestions [ id ] . a [ 2 ] . text ; answer4El . textContent = myQuestions [ id ] . a [ 3 ] . text ; answer1El . value = myQuestions [ id ] . a [ 0 ] . correct ; answer2El . value = myQuestions [ id ] . a [ 1 ] . correct ; answer3El . value = myQuestions [ id ] . a [ 2 ] . correct ; answer4El . value = myQuestions [ id ] . a [ 3 ] . correct ; return ; }
Create a function that uses an id variable to replace the former question with the next question's text from the myQuestions array above
Create a function that uses an id variable to replace the former question with the next question ' s text from the myQuestions array above
//Set default button backgrounds and make result text empty //Fill in question and answers with first index in myQuestions object // Gather whether the value is correct or incorrect using the boolean value in the object