Skip to content

Instantly share code, notes, and snippets.

@jwhitley
Created December 9, 2011 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwhitley/1449621 to your computer and use it in GitHub Desktop.
Save jwhitley/1449621 to your computer and use it in GitHub Desktop.
// Run me as 'node nested_function.js'
var some_text = [ "a", "b", "c"];
var printit = function (text, f) {
console.log(text);
f();
}
var nested = some_text.reduceRight(function(prev, curr) {
return function () {
printit(curr, prev);
};
}, function () { console.log("bootstrap value"); });
nested();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment