Contact: aviboots(AT)netvision.net.il
39,911 questions
51,843 answers
573 users
function getRandomItem(arr) { const index = Math.floor(Math.random() * arr.length); return arr[index]; } const array = [1, 2, 5, 9, 4, "a", "b", "c"]; const result = getRandomItem(array); console.log(result); /* run: b */