1098 Part (Web server) IV . JavaScript Core Language Reference
1098 Part IV . JavaScript Core Language Reference caller Value: Function Object Reference Read-Only Compatibility NN2 NN3 . NN4 . NN6 IE3/J1 IE3/J2 . IE4 . IE5 . IE5.5 . Note The caller property, not part of the ECMA-262 standard, was removed from NN for version 6. When one function invokes another, a chain is established between the two primarily so that a returned value knows where to go. Therefore, a function invoked by another maintains a reference to the function that called it. Such information is automatically stored in a function object as the callerproperty. This relationship reminds me a bit of a subwindow s opener property, which points to the window or frame responsible for the subwindow s creation. The value is valid only while the called function is running at the request of another function; when a function isn t running, its caller property is null. The value of the callerproperty is a reference to a function object, so you can inspect its arguments and callerproperties (in case it was called by yet another function). Thus, a function can look back at a calling function to see what values it was passed. The functionName.caller property reveals the contents of an entire function definition if the current function was called from another function (including an event handler). If the call for a function comes from a regular JavaScript statement not originating from inside a function, the functionName.callerproperty is null. To help you grasp all that these two properties yield, study Listing 41-1. Listing 41-1: A Function s arguments and caller Properties