Skip to content

Instantly share code, notes, and snippets.

@shaunwallace
Created November 19, 2014 12:05
Show Gist options
  • Save shaunwallace/91f74ec3173d16c44fce to your computer and use it in GitHub Desktop.
Save shaunwallace/91f74ec3173d16c44fce to your computer and use it in GitHub Desktop.
Arguments.callee
// this would not work since unnamed functions could not be passed and then called again inside of themselves
[1,2,3,4,5].map(function (n) {
return !(n > 1) ? 1 : /* what goes here? */ (n - 1) * n;
});
// arguments.callee was added so you could do the following
[1,2,3,4,5].map(function (n) {
return !(n > 1) ? 1 : arguments.callee(n - 1) * n;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment