Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)];
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #item #array #javascript
ADD COMMENT
Topic
Name
9+7 =