Each function has a property caller.
From https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Function/caller :
function myFunc() {
if (myFunc.caller == null) {
return ("The function was called from the top!");
} else
return ("This function caller was " + myFunc.caller);
}
}
The property is Function.callernot part of the ECMA3 standard, but is implemented in all major browsers, including IE and Firefox.
, caller arguments.calee:
function() {
if (arguments.callee.caller == null) {
return ("The function was called from the top!");
} else
return ("This function caller was " + arguments.callee.caller);
}
}
, , caller . deprecated arguments.caller, .