Я пытаюсь получить ответы на вопросы после отправки первого.Мне также нужно рассчитать счет.просто повесил трубку и ищу любую помощь, которую я могу получить
let questions = [
{
question : "how many stages are in the tour de france?",
options : [
{
option : "2"
},
{
option : "10"
},
{
option : "15"
},
{
option : "21"
}
],
answer : "D"
},
{
question : "how many guys are on each team?",
options : [
{
option :"9"
},
{
option : "10"
},
{
option : "8"
},
{
option : "7"
}
],
answer : "A"
},
{
question : "how many times did Lance Armstrong win the tour?",
options : [
{
option :"7"
},
{
option : "4"
},
{
option : "2"
},
{
option : "9"
}
],
answer : "A"
},
{
question : "who won in 2018?",
options : [
{
option :"Garrent Thomas"
},
{
option : "Chris Froome"
},
{
option : "Peter Sagan"
},
{
option : "Taylor Phinney"
}
],
answer : "A"
},
{
question : "what team won the tour in 2017",
options : [
{
option :"Movistar"
},
{
option : "Bora"
},
{
option : "sky"
},
{
option : "dropac"
}
],
answer : "c"
},
];
я знаю, что мне нужно что-то сделать с этими двумя буквами ниже
let currentQuestion = 0;console.log (currentQuestion);
let score = 0;
функция renderQuestion () {
return `
<fieldset>
<legend> ${questions[currentQuestion].question} </legend>
<input type="radio" name="option"
value="A">${questions[currentQuestion].options[0].option}<br>
<input type="radio" name="option"
value="B">${questions[currentQuestion].options[1].option}<br>
<input type="radio" name="option"
value="C">${questions[currentQuestion].options[2].option}<br>
<input type="radio" name="option"
value="D">${questions[currentQuestion].options[3].option}<br>
<button type="submit" class="submitAnswer"> Submit answer </button>
</fieldset>
`;
}
function startQuiz(){
$('.quizAppForm').on('click', '.startQuiz', function(event){
event.preventDefault();
$('.quizAppForm').html(renderQuestion);
});
}
function init(){
startQuiz();
}
$(init);