random item from an array js code example
Example 1: get random element from array js
var item = items[Math.floor(Math.random() * items.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])