Skip to content

Instantly share code, notes, and snippets.

@mde
Created September 22, 2015 00:06
Show Gist options
  • Save mde/3a92c18db6bef2703e9f to your computer and use it in GitHub Desktop.
Save mde/3a92c18db6bef2703e9f to your computer and use it in GitHub Desktop.
Iterative, but CPS
var iterativeRunner = function (arr) {
var funcs = arr.map(function (item, index) {
return function () {
item(function () {
if (funcs[index + 1]) {
funcs[index + 1]();
}
});
};
});
funcs[0]();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment