JavaScript Bible, Gold Edition part 126. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | 1098 Part IV JavaScript Core Language Reference caller Value Function Object Reference Read-Only NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility 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 caller property. 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 caller property is a reference to a function object so you can inspect its arguments and caller properties 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 property 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 HTML HEAD SCRIPT LANGUAGE JavaScript function hansel x y var args P is BR is BR for var i 0 i i argument i is args i BR P Chapter 41 Functions and Custom Objects 1099 function gretel x y z today new Date thisYear hansel x y z .