Created
November 19, 2014 12:05
-
-
Save shaunwallace/91f74ec3173d16c44fce to your computer and use it in GitHub Desktop.
Arguments.callee
This file contains hidden or 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
// 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