I have a delayed loop working that displays the numbers 0-3 with a 1 second delay, but I want it to then start this process all over again.
I tried putting the whole code into a while loop with x<99 (something that will never occur therefore making the loop repeat forever) This doesn't seem to be working
Here is the code:
sequence=["0","1","2","3"];
while (x<99) {
x=-1;
(function myLoop (i) {
setTimeout(function () {
x++;
document.write(sequence[x] + "<br/>");
if (--i) myLoop(i);
}, 1000)
})(4);
}
Can someone please help?
Thanks