how to get random index javasript code example
Example 1: get random item from array javascript
const randomElement = array[Math.floor(Math.random() * array.length)];
Example 2: get random entry from array javascript
const rnd = (arr) => { return arr[Math.floor(Math.random() * arr.length)] };