Answers for "random array of numbers"

68

javascript get random array value

//get random value from array
var colors = ["red","blue","green","yellow"];
var randColor = colors[Math.floor(Math.random() * colors.length)];
Posted by: Guest on July-31-2019
0

define function to get random value from array

const randomValue = (list) => {
    return list[Math.floor(Math.random() * list.length)];
};
Posted by: Guest on January-30-2022

Code answers related to "random array of numbers"

Code answers related to "Javascript"

Browse Popular Code Answers by Language