August 2006
Intermediate to advanced
1018 pages
34h 13m
English
Arguments.callee: the function that is currently running — ECMAScript v1
arguments.callee
arguments.callee refers to
the function that is currently running. It provides a way for an
unnamed function to refer to itself. This property is defined only
within a function body.
// An unnamed function literal uses the callee property to refer
// to itself so that it can be recursive
var factorial = function(x) {
if (x < 2) return 1;
else return x * arguments.callee(x-1);
}
var y = factorial(5); // Returns 120Read now
Unlock full access