how to get a random statement from an array in javascript code example
Example 1: javascript get random array value
var colors = ["red","blue","green","yellow"];
var randColor = colors[Math.floor(Math.random() * colors.length)];
Example 2: how do you make a random array in javascript
const Coins = ["Heads","Tails"]
let Generate = Math.floor((Math.random() * Coins.length));
console.log(Coins[Generate])
Example 3: how to get a random statement from an array in javascript
let Testing1 = ["put","things","here"]
let Generate = Math.floor((Math.random() * Testing1.length));
console.log(Testing1[Generate])