{{jsSidebar("Errors")}}
Message
Warning: ReferenceError: deprecated caller usage Warning: ReferenceError: deprecated arguments usage
Error type
A warning that a {{jsxref("ReferenceError")}} occurred. JavaScript execution won't be halted.
What went wrong?
In strict mode, the {{jsxref("Function.caller")}} or {{jsxref("Function.arguments")}} properties are used and shouldn't be. They are deprecated, because they leak the function caller, are non-standard, hard to optimize and potentially a performance-harmful feature.
Examples
Deprecated function.caller
or arguments.callee.caller
{{jsxref("Function.caller")}} and arguments.callee.caller
are deprecated (see the reference articles for more information).
"use strict"; function myFunc() { if (myFunc.caller == null) { return 'The function was called from the top!'; } else { return 'This function\'s caller was ' + myFunc.caller; } } myFunc(); // Warning: ReferenceError: deprecated caller usage // "The function was called from the top!"
Function.arguments
{{jsxref("Function.arguments")}} is deprecated (see the reference article for more information).
"use strict"; function f(n) { g(n - 1); } function g(n) { console.log('before: ' + g.arguments[0]); if (n > 0) { f(n); } console.log('after: ' + g.arguments[0]); } f(2); console.log('returned: ' + g.arguments); // Warning: ReferenceError: deprecated arguments usage
See also
- Deprecated and obsolete features
- Strict mode
- {{jsxref("Function.arguments")}}
- {{jsxref("Function.caller")}} and
arguments.callee.caller