nodejs random array code example
Example 1: get random element from array js
var item = items[Math.floor(Math.random() * items.length)];
Example 2: random array javascript
const months = ["January", "February", "March", "April", "May", "June", "July"];
const random = Math.floor(Math.random() * months.length);
console.log(random, months[random]);