arguments.callee

Availability

Flash Player 5.

Usage

arguments.callee

Description

Property; refers to the function that is currently being called.

Example

You can use the arguments.callee property to make an anonymous function that is recursive, as in the following:

factorial = function (x) {
  if (x <= 1) {
    return 1;
  } else {
    return x * arguments.callee(x-1);
  }
};

The following is a named recursive function:

function factorial (x) {
  if (x <= 1) {
    return 1;
  } else {
    return x * factorial(x-1);
  }
}