function showQuetions(index) {
  var que_text = document.querySelector(".que_text");

  //creating a new span and div tag for question and option and passing the value using array index
  var que_tag = '<span>' + quizQuestions[index].numb + ". " + quizQuestions[index].question + '</span>';
  var option_tag = '<div class="option"><span>' + quizQuestions[index].options[0] + '</span></div>'
    + '<div class="option"><span>' + quizQuestions[index].options[1] + '</span></div>'
    + '<div class="option"><span>' + quizQuestions[index].options[2] + '</span></div>'
    + '<div class="option"><span>' + quizQuestions[index].options[3] + '</span></div>';
  que_text.innerHTML = que_tag; //adding new span tag inside que_tag
  option_list.innerHTML = option_tag; //adding new div tag inside option_tag

  var option = option_list.querySelectorAll(".option");

  // set onclick attribute to all available options
  for (i = 0; i < option.length; i++) {
    option[i].setAttribute("onclick", "optionSelected(this)");
  }
}
// getting questions and options from array
getting questions and options from array
getting questions and options from array
function showQuetions(index) {
  var que_text = document.querySelector(".que_text");
  var que_tag = '<span>' + quizQuestions[index].numb + ". " + quizQuestions[index].question + '</span>';
  var option_tag = '<div class="option"><span>' + quizQuestions[index].options[0] + '</span></div>'
    + '<div class="option"><span>' + quizQuestions[index].options[1] + '</span></div>'
    + '<div class="option"><span>' + quizQuestions[index].options[2] + '</span></div>'
    + '<div class="option"><span>' + quizQuestions[index].options[3] + '</span></div>';
  que_text.innerHTML = que_tag; 
  option_list.innerHTML = option_tag; 
  var option = option_list.querySelectorAll(".option");
  for (i = 0; i < option.length; i++) {
    option[i].setAttribute("onclick", "optionSelected(this)");
  }
}
function showQuetions ( index ) { var que_text = document . querySelector ( ".que_text" ) ; var que_tag = '<span>' + quizQuestions [ index ] . numb + ". " + quizQuestions [ index ] . question + '</span>' ; var option_tag = '<div class="option"><span>' + quizQuestions [ index ] . options [ 0 ] + '</span></div>' + '<div class="option"><span>' + quizQuestions [ index ] . options [ 1 ] + '</span></div>' + '<div class="option"><span>' + quizQuestions [ index ] . options [ 2 ] + '</span></div>' + '<div class="option"><span>' + quizQuestions [ index ] . options [ 3 ] + '</span></div>' ; que_text . innerHTML = que_tag ; option_list . innerHTML = option_tag ; var option = option_list . querySelectorAll ( ".option" ) ; for ( i = 0 ; i < option . length ; i ++ ) { option [ i ] . setAttribute ( "onclick" , "optionSelected(this)" ) ; } }
getting questions and options from array
getting questions and options from array
//creating a new span and div tag for question and option and passing the value using array index //adding new span tag inside que_tag //adding new div tag inside option_tag // set onclick attribute to all available options