arguments.caller

JavaScript 1.2+ Nav4+ Syntax

arguments.caller

Description

The caller property of the Arguments object contains the Arguments object of the calling function. If the given function was not executed from within another function, null is stored in this property.

Example

Listing 6.45 creates two functions. One displays an individual's favorite food in an alert box, while the other displays the number of arguments associated with the calling function. Anytime a button is clicked, an alert box displays the favorite food. This function then calls the second function to display an alert box saying there were two arguments passed into the first function.

Listing 6.45 Using the caller Property of the Arguments Object
 <html> ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.