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