I have an array that stores the values:
var array = [['favorite color'],['black','red']]
to get black I would:
document.write(array[0][1][0]);
then if i append to the array another question [['favorite thing']['box','ball']]
If I wanted ball I would:
document.write.array[1][1][1];
I am having trouble understanding arrays. I want an array with one question and multiple answers then I want to loop through them and display everything. I can do the loop but I am unsure how to find things in nested arrays once I create them.
array[0][1][0]. No, that would result in an error. This would imply a structure such as[[...,['black',...]], ...]. You would get black witharray[1][0]becausearrayhas to two elements, both arrays, and you want to get the first element (0) of the second array (1).