I am trying to figure out how I can populate my jeopardy-esque quiz game with arrays, so I can have randomly generated questions. Currently I am setting my questions up like this:
Array reading as Question ID | Question | Question Options | Correct Answer
var cat1question1easy = ["1", "What color is the sky?", "Red", "Pink", "Blue", "Green", "Bluecorrect"];
cat1question1easy.name = "cat1question1easy";
var cat2question2easy = ["2", "What color is grass", "Yellow", "Purple", "Black", "Green", "Greencorrect"];
cat1question2easy.name = "cat1question2easy";
var cat3question3easy = ["3", "What color is dirt?", "Brown", "White", "Turqouise", "Gray", "Browncorrect"];
cat1question3easy.name = "cat1question3easy";
Then I store them into an array for easy questions:
var cat1easyquestions = newArray(cat1question1easy, cat1question2easy, cat1question1easy);
Then I pull my random question for the 'question 1' slot by using:
var randomcat1easyquestion = cat1easyquestions[Math.floor(Math.random()*items.length)]
Which brings me to my main question, if my html for my question looks like this:
<h3></h3>
<input type="radio" name="" value="">
<input type="radio" name="" value="">
<input type="radio" name="" value="">
<input type="radio" name="" value="">
How could I populate it so it pulls my array's info so it shows as:
<h3>What color is the sky?</h3>
<input type="radio" value="Red">
<input type="radio" value="Pink">
<input type="radio" value="Blue">
<input type="radio" value="Green">
Is this a viable way to generate a random jeopardy board? or should I be looking at a better route?