New course! Every coder should learn Generative AI!
Try a free lesson+ 2
How to get a random option form the array
2 Answers
+ 2
var rnd= Math.floor(Math.random()*number)
arr[rnd]
0
Define a random number based on the size of your array and then state: array.get(randomnumber)