lundi 8 mai 2017

JavaScript Random Function does not work

All I want to do is have the program select random questions (each question is within a function and fills a blank area in the HTML so all questions appear in the same area) but it does not work. Does anyone have any idea why? I am meant to click correct answer and it executes the correctFunction but nothing happens. Cheers!

var randomFunctions = [
  "Question2", "Question3",
  "Question4", "Question5",
  "Question6", "Question7",
  "Question8"
];

var rand = randomFunctions[Math.floor(Math.random() * randomFunctions.length)];

function correctFunction() {
  rand();
}

correctFunction()



Aucun commentaire:

Enregistrer un commentaire