script.js
// function to ask a question from a given array and question number
function to ask a question from a given array and question number
function to ask a question from a given array and question number
function askQuestion(questionNumber) {
  choicesListEl.innerHTML = "";
  questionTextEl.textContent = jsQuizQuestions[questionNumber].question;
  for (j = 0; j < jsQuizQuestions[questionNumber].choices.length; j++) {
    let liEl = document.createElement("li"); 
    liEl.setAttribute("class", "m-2"); 
    choicesListEl.appendChild(liEl);
    let buttonEl = document.createElement("button"); 
    buttonEl.setAttribute("class", "btn btn-primary"); 
    buttonEl.setAttribute("data-choiceIndex", j); 
    buttonEl.textContent =
      j + 1 + ". " + jsQuizQuestions[questionNumber].choices[j];
    liEl.appendChild(buttonEl);
  }
}
function askQuestion ( questionNumber ) { choicesListEl . innerHTML = "" ; questionTextEl . textContent = jsQuizQuestions [ questionNumber ] . question ; for ( j = 0 ; j < jsQuizQuestions [ questionNumber ] . choices . length ; j ++ ) { let liEl = document . createElement ( "li" ) ; liEl . setAttribute ( "class" , "m-2" ) ; choicesListEl . appendChild ( liEl ) ; let buttonEl = document . createElement ( "button" ) ; buttonEl . setAttribute ( "class" , "btn btn-primary" ) ; buttonEl . setAttribute ( "data-choiceIndex" , j ) ; buttonEl . textContent = j + 1 + ". " + jsQuizQuestions [ questionNumber ] . choices [ j ] ; liEl . appendChild ( buttonEl ) ; } }
function to ask a question from a given array and question number
function to ask a question from a given array and question number
// clear old choices //ask the question // list choices for the question as buttons //create list element for options within ol //bootstrap classes here //create buttons within li element //bootstrap classes here //for event listener event delegation