generate random array from a list javascript 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)