function question1(){
if(sessionStorage.quizCounter == 0){
var qa0 = qs[Math.floor(Math.random() * 19)];
document.getElementById('questions_container').innerHTML = qa0[0]
for (let i = 1; i <= 3; i++) {
document.getElementById('answers_container').innerHTML += qa0[Math.floor((Math.random() * 2))+1];
}
}
}
Aight so that's my function it's supposed to place the first item in the array in a <div id="questions_container">
wich works but the second part, the for-loop, doesn't.
The for-loop is supposed to paste the last 3 items randomly in <div id="answers_container">
. And straight up got no idea on how to do that other than
qa0[0] is always the question. qa0[1, 2, 3] is always the answeres. qa0[] qontains always 4 items.
Aucun commentaire:
Enregistrer un commentaire