Function caller and arguments
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
Note: The arguments property of Function objects is deprecated. The recommended way to access the arguments object is to refer to the variable arguments available within functions.
The arguments accessor property of Function instances returns the arguments passed to this function. For strict, arrow, async, and generator functions, accessing the arguments property throws a TypeError.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
javascript.builtins.Function.arguments Deprecated Non-standard | 1 | 12 | 1 | 1 | 18 | 1 |
| Built-in object | ||||||
Function.caller Deprecated Non-standard The caller accessor property of Function instances returns the function that invoked this function. For strict, arrow, async, and generator functions, accessing the caller property throws a TypeError. | 1 | 12 | 1 | 3 | 18 | 1 |
Syntax
// Function caller and arguments example
// See MDN Web Docs for details Live demo
Inspect caller relationships
Read which function invoked another function in a legacy pattern.
Inspect function arguments length
Read the old function arguments object directly from inside the function.
Compare legacy and rest parameters
Show the older arguments object next to a modern rest parameter version.
Use cases
-
Legacy cleanup
Remove caller and arguments dependencies when modernizing older function-heavy code.
-
Historical debugging
Understand why old code relied on runtime call inspection before replacing it with explicit logic.
Cautions
- These features are deprecated and create fragile coupling between functions.
- Code that depends on caller inspection is usually harder to optimize, test, and reason about.
Accessibility
- No direct accessibility effect, but removing brittle runtime tricks improves long-term UI stability.
- Prefer explicit data flow so assistive-technology-critical behavior remains predictable.