excute a loop for five seconds code example
Example: loop every 5 seconds
for(var i = 0; i < 3; i++) {
(function(index) {
setTimeout(function() { alert(index); }, index*5000);
})(i);
}
for(var i = 0; i < 3; i++) {
(function(index) {
setTimeout(function() { alert(index); }, index*5000);
})(i);
}