create an array of random in code example
Example 1: how do you make a random array in javascript
// how to generate random words from an array
const Coins = ["Heads","Tails"]
let Generate = Math.floor((Math.random() * Coins.length));
console.log(Coins[Generate]) // this will print the outcome
Example 2: how to get random item from an array
//Function to make it easier
Array.prototype.random = function() {
return this[Math.floor((Math.random() * this.length))];
};
var colors = ["red","blue","green","yellow"];
var randomColor = colors.random();