1//get random value from array
2var colors = ["red","blue","green","yellow"];
3var randColor = colors[Math.floor(Math.random() * colors.length)];
4
1var items = ['Yes', 'No', 'Maybe'];
2var item = items[Math.floor(Math.random() * items.length)];
1// how to generate random words from an array
2const Coins = ["Heads","Tails"]
3let Generate = Math.floor((Math.random() * Coins.length));
4
5console.log(Coins[Generate]) // this will print the outcome
1// List your array items
2let Testing1 = ["put","things","here"]
3let Generate = Math.floor((Math.random() * Testing1.length)); // Generates a number of the array.
4
5// logs the result
6console.log(Testing1[Generate])