An array will allow you to store multiple values in a single variable.
var myArr = [56, 287 , 'media' , 48 , 'pink' , 'green' , 23, 'glorious' , 985 , 88]; var randArrItem = myArr[Math.floor(Math.random() * myArr.length)]; console.log(randArrItem);
We can get a particular item from an array just by passing the index number just like we can see below:
myArr // Output: media
In the end, we have passed the random array item variable to our console log to see the result.