Function caller and arguments
Function.caller and Function.arguments are legacy introspection features that expose call-chain details. Modern JavaScript avoids these patterns because they are brittle and restricted in strict mode.
Overview
Function.caller and Function.arguments are legacy introspection features that expose call-chain details. Modern JavaScript avoids these patterns because they are brittle and restricted in strict mode.
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.
Related links
Powered by web-features