Created
January 29, 2012 21:58
-
-
Save pauliusuza/1700902 to your computer and use it in GitHub Desktop.
Recursive Function Pattern in JS
This file contains 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
arr = []; | |
(function recurse(url, i) { | |
getNextUrl(url, function(err, nextUrl) { | |
if (!err) { | |
arr.push(nextUrl); | |
if (i < 100) recurse(nextUrl, i++); | |
} | |
}); | |
}("", 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment