We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

caller Property

Returns a reference to the function that invoked the current function.



Required. The name of the currently executing Function object.

The caller property is only defined for a function while that function is executing. If the function is called from the top level of a JScript program, caller contains null.

If the caller property is used in a string context, the result is the same as functionName.toString, that is, the decompiled text of the function is displayed.


The caller property is not available when a program is running in fast mode, the default for JScript. To compile a program that uses the caller property 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.

The following example illustrates the use of the caller property.

function callLevel()
    if (callLevel.caller == null)
        print("callLevel was called from the top level.");
        print("callLevel was called by:");

function testCall()

// Call callLevel directly.
// Call callLevel indirectly.

The output of this program is as follows.

callLevel was called from the top level.
callLevel was called by:
function testCall() {