Skip to content

Instantly share code, notes, and snippets.

@htmelvis
Created February 15, 2016 13:45
Show Gist options
  • Save htmelvis/ef44d47b1f8635983fcc to your computer and use it in GitHub Desktop.
Save htmelvis/ef44d47b1f8635983fcc to your computer and use it in GitHub Desktop.
Timed Iteration in JavaScript
(function() {
var i = 0,
adArray = [13,14,15,16,17,18,19,110,111,112,113,114,115,116],
l = adArray.length;
(function iterator() {
console.log('Loop: ', i, ' Loop content: ', adArray[i]);
//update before evaluating the conditional
if (++i < l) {
setTimeout(iterator, 1500);
}
})();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment