Answers for "random chose from a list node js"

1

how to get a randome element from a list in javascript

let numList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let randomElem = numList[Math.floor(Math.random() * numList.length)];
console.log(randomElem);
Posted by: Guest on March-30-2021

Code answers related to "random chose from a list node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language