I\'ve been searching around for some answers to this issue, but nothing seems to work when I try to find a solution.
What I\'m trying to achieve is to make a spinner
var array = [];
setInterval(function(){
if(array .length === 0){
reload();
}
var result = getRandom();
console.log(result);
},1000);
function getRandom(){
var index = (array.length === 1 ? 0 : Math.floor(Math.random() * array.length));
return array.splice(index, 1)[0];
}
function reload(){
array = [2,3,4,5,6,7,8,9,0,1,44,66];
}