+ 1
Pick a random item
How do I pick a random item from an array in JavaScript?
2 ответов
+ 2
var arr=[];
/* set values to 'arr' array */
var c=arr.length-1;
var i=Math.round(c*Math.random())
document.write(arr[i]);
+ 1
thanks
How do I pick a random item from an array in JavaScript?