Select Random Item from an Array

PHOTO EMBED

Wed Apr 29 2020 11:38:33 GMT+0000 (Coordinated Universal Time)

Saved by @CutePixel #javascript

 var myArray = [
  "Apples",
  "Bananas",
  "Pears"
];

var randomItem = myArray[Math.floor(Math.random()*myArray.length)];
                                
content_copyCOPY

If you want to select Random Item from an Array use this code.

https://css-tricks.com/snippets/javascript/select-random-item-array/