Categories
Returns a random element from an array.
Contributed by @itsbrunodev
function randomItem(arr) { return arr[Math.floor(Math.random() * arr.length)]; }
randomItem([1, 2, 3, 4, 5]); // 3