In JavaScript, eval
is used to add or remove bindings and to change binding values.
arguments
is used to access function arguments through indexed properties.
As a consequence, those 2 names eval
and arguments
should not be bound or assigned
as it would overwrite the original definition of those 2 elements.
What's more, using those 2 names to assign or bind will generate an error in JavaScript strict mode code.
The following code snippet illustrates cases that will generate violations (changing the names turns the different non-compliant cases into compliant cases):
eval = 17; // Non-Compliant arguments++; // Non-Compliant ++eval; // Non-Compliant var obj = { set p(arguments) { } }; // Non-Compliant var eval; // Non-Compliant try { } catch (arguments) { } // Non-Compliant function x(eval) { } // Non-Compliant function arguments() { } // Non-Compliant var y = function eval() { }; // Non-Compliant var f = new Function("arguments", "return 17;"); // Non-Compliant function fun() { if (arguments.length == 0) { // Compliant // do something } }