Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how do you make a random array in javascript

// how to generate random words from an array
const Coins = ["Heads","Tails"]
let Generate = Math.floor((Math.random() * Coins.length));

console.log(Coins[Generate]) // this will print the outcome
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #array #javascript
ADD COMMENT
Topic
Name
2+1 =