-1

I got three arrays all full with 9 images each. Now I'd like to make it so that whenever the page is refreshed, it shows the images of one of the arrays. So it chooses at random which array to show the images of. I just really can't think of a way to make this work atm.

I did find a way to show random images on refresh, but can't find a way to choose a complete array randomly I'm using jQuery

1 Answers1

1

Here is how you get a random number from 0 - 8 in JavaScript:

Math.floor(Math.random() * 9)

From there you can use that random number for selecting an index of your array.

jasonmerino
  • 3,220
  • 1
  • 21
  • 38