Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var arr = [1, 2, 3, 4, 5];
- var maxLoops = Number(arr.length);
- var counter = -1;
- (function next() {
- if (counter++ > maxLoops);
- setTimeout(function() {
- alert(arr[counter]);
- next();
- }, 5000);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement