TypeError: 'arguments', 'callee' and 'caller' are restricted function properties and cannot be accessed in this context (Edge) Warning: ReferenceError: deprecated caller usage (Firefox) Warning: ReferenceError: deprecated arguments usage (Firefox) TypeError: 'callee' and 'caller' cannot be accessed in strict mode. (Safari)
A strict-mode-only warning that a ReferenceError occurred. JavaScript execution won't be halted.
In strict mode, the Function.caller or 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.
function.caller or arguments.callee.caller
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.argumentsFunction.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
Function.argumentsFunction.caller and arguments.callee.caller
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_caller_or_arguments_usage