The arguments.callee property can be used to access the currently executing function, while the non-standard arguments.caller property provides access to its caller. Using these properties makes code hard to read, however, so they should be avoided.

Instead of using arguments.callee, you can refer to the enclosing function by its name (possibly giving it a name first if it is an anonymous function expression). Uses of arguments.caller can often be eliminated by refactoring the program.

In the following example, arguments.callee is used to recursively invoke the enclosing function, which is anonymous.

To avoid this use, the function can be given a name and referred to using that name:

  • Mozilla Developer Network: arguments.