Answers for "random array from numbers javascript function"

16

javascript how to get a random element from an array

var items = ['Yes', 'No', 'Maybe'];
var item = items[Math.floor(Math.random() * items.length)];
Posted by: Guest on March-19-2020
2

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
Posted by: Guest on August-05-2020

Code answers related to "random array from numbers javascript function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language