Skip to content

Instantly share code, notes, and snippets.

@dshaw
Created May 1, 2010 05:41
Show Gist options
  • Save dshaw/386079 to your computer and use it in GitHub Desktop.
Save dshaw/386079 to your computer and use it in GitHub Desktop.
Replacing named function reference with arguments.callee
// From @jeresig
// http://ejohn.org/apps/learn/#15
var ninja = {
yell: function(n){
return n > 0 ? arguments.callee(n-1) + "a" : "hiy";
}
};
assert( ninja.yell(4) == "hiyaaaa", "arguments.callee is the function itself." );
@dshaw
Copy link
Author

dshaw commented May 1, 2010

Though it's worth noting that arguments.callee is deprecated. Further discussion here: http://stackoverflow.com/questions/103598/why-was-the-arguments-callee-caller-property-deprecated-in-javascript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment