I am writing a quiz sort of game and I want the background to change every time there is a new question. Could someone help me with either how to code this or ideally the code? (I haven't copied the array in as it links to a CSV.
Here is my current code:
for (var i = 1; i <= 100; i++) {
var number = Math.floor((Math.random() * 18) + 1);
var stringGuess = prompt(questions[number])
if(stringGuess == answers[number]){
alert("YOU GOT IT RIGHT!! THE ANSWER IS " + answers[number])
}
else if (stringGuess > answers[number]){
alert("Too high. The answer is " + answers[number]);
}
else{
alert("Too low. The answer is " + answers[number]);
}}}
Thank you!!!
Aucun commentaire:
Enregistrer un commentaire