Share via


callee Property

Returns the Function object being executed, that is, the body text of the specified Function object.

[function.]arguments.callee

Arguments

  • function
    Optional. The name of the currently executing Function object.

Remarks

The callee property is a member of the arguments object that becomes available only when the associated function is executing.

The initial value of the callee property is the Function object being executed. This allows anonymous functions to be recursive.

Note

The arguments object is not available when a program is running in fast mode, the default for JScript. To compile a program that uses the arguments object from a command prompt, you must turn off the fast option by using /fast-. It is not safe to turn off the fast option in ASP.NET because of threading issues. For more information, see arguments Object.

Example

The following example illustrates the use of the callee property.

function factorial(n) {
    if (n <= 0)
        return 1;
    else
        return n * arguments.callee(n - 1)
}
print(factorial(4));
// Output: 24

Requirements

Version 5.5

Applies To:

arguments Object| Function Object

See Also

Reference

function Statement

Change History

Date

History

Reason

July 2009

Modified example.

Content bug fix.

July 2009

Modified note about the /fast option.

Content bug fix.

March 2009

Modified example and information about /fast option.

Information enhancement.