1//get random value from array
2var colors = ["red","blue","green","yellow"];
3var randColor = colors[Math.floor(Math.random() * colors.length)];
4
1var colors = ["red","blue","green","yellow"];
2var randomColor = colors[Math.floor(Math.random()*colors.length)]; //pluck a random color
3
1var myArray = [
2 "Apples",
3 "Bananas",
4 "Pears"
5];
6
7var randomItem = myArray[Math.floor(Math.random()*myArray.length)];