how to select a random item in a json array javascript code example
Example 1: get random elements from array javascript
array.sort(() => Math.random() - Math.random()).slice(0, n)
Example 2: js random string from array
const randomElement = array[Math.floor(Math.random() * array.length)];