📜  你如何在javascript代码示例中创建一个随机数组

📅  最后修改于: 2022-03-11 15:04:19.710000             🧑  作者: Mango

代码示例1
// 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