Answers for "random index in array length"

3

get random entry from array javascript

const rnd = (arr) => { return arr[Math.floor(Math.random() * arr.length)] };
Posted by: Guest on January-12-2021
-1

get random item from array javascript

let items = [12, 548 , 'a' , 2 , 5478 , 'foo' , 8852, , 'Doe' , 2145 , 119];

let  randomItem = items[Math.floor(Math.random() * items.length)];
Posted by: Guest on November-20-2020

Code answers related to "random index in array length"

Code answers related to "Javascript"

Browse Popular Code Answers by Language