I have written a bit of jQuery to loop through items in a array an display a random number and then move on to display another number. The problem is I want to put a delay inside the loop so that it shows the number for 2 seconds and then moves of to the next. so you see a random number it holds for 2 seconds and then moves on to the next. I have tried putting a timeout inside the loop but that didn't work. Any help would be amazing thanks.
function RandomNumberGenerator(){
var myArray = new Array(99);
for (var i=0; i< 99; i++) {
myArray[i] = Math.floor(Math.random()*100)
myArrayTwo[i] = Math.floor(Math.random()*100)
}
for (var i=0; i< 9; i++) {
$('li.num').text(function(index) {
// timeout needs to be here somewhere
return (myArray[i]);
})
}
});
}
myArrayTwodefined?