how to put random numbers into an array js code example
Example 1: javascript return a random value from an array
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
const randomMonth = months[Math.floor(Math.random() * months.length)];
console.log("random month =>", randomMonth);
Example 2: generate an array of random numbers javascript
let numbersArray = [] , max = 100;
for( var i=1; numbersArray.push(i++) < max;);