Created
April 8, 2015 16:54
-
-
Save tmlangley/46f3997a0ab778ec1d7f to your computer and use it in GitHub Desktop.
loop delay with recursion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* From Daniel Vassallo: | |
* http://stackoverflow.com/questions/3583724/how-do-i-add-a-delay-in-a-javascript-loop/3583740#3583740 | |
*/ | |
(function loop(i) { | |
setInterval(function() { | |
// do stuff... | |
if (--i) loop(i); | |
}, 2000); | |
})(10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment