Rule Definition
This API is forbidden in strict mode, hampers optimization and clarity.
Remediation
Name your functions; pass functions explicitly.
Violation Code Sample
(function(){ return arguments.callee(1); })();
function maFonction() {
if (maFonction.caller == null) {
return "Function called on top level !";
} else {
return "Function called by " + maFonction.caller;
}
}
Fixed Code Sample
(function self(){ return self(); })();
Reference
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee
https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Function/caller
Related Technologies
Technical Criterion
CWE-710 - Improper Adherence to Coding Standards [Pillar]
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.