how do you get a random object from an array in javascript code example
Example 1: get random item from array javascript
const randomElement = array[Math.floor(Math.random() * array.length)];
Example 2: how to get a random statement from an array in javascript
// List your array items
let Testing1 = ["put","things","here"]
let Generate = Math.floor((Math.random() * Testing1.length)); // Generates a number of the array.
// logs the result
console.log(Testing1[Generate])