Skip to content

Instantly share code, notes, and snippets.

@irace
Created July 26, 2011 02:54
Show Gist options
  • Save irace/1105846 to your computer and use it in GitHub Desktop.
Save irace/1105846 to your computer and use it in GitHub Desktop.
Chaining numerous invocations of the same anonymous JavaScript function
// Please let me know if one approach is better than the other
(function(arg) {
alert(arg);
return arguments.callee;
}('foo')('bar')('baz'));
(function f(arg) {
alert(arg);
return f;
}('foo')('bar')('baz'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment