JavaScript has special identifiers that, while not reserved, still should not be used as identifiers. They include:
eval - evaluates a string as JavaScript code arguments - used to access function arguments through indexed properties. undefined - returned for values and properties that have not yet been assigned NaN - Not a Number; returned when math functions fail. Infinity - when a number exceeds the upper limit of the floating point numbers
These words should not be bound or assigned, because doing so would overwrite the original definitions of these identifiers. What's more, assigning or binding some of these names will generate an error in JavaScript strict mode code.
eval = 17; // Noncompliant
arguments++; // Noncompliant
++eval; // Noncompliant
var obj = { set p(arguments) { } }; // Noncompliant
var eval; // Noncompliant
try { } catch (arguments) { } // Noncompliant
function x(eval) { } // Noncompliant
function arguments() { } // Noncompliant
var y = function eval() { }; // Noncompliant
var f = new Function("arguments", "return 17;"); // Noncompliant
function fun() {
if (arguments.length == 0) { // Compliant
// do something
}
}
result = 17;
args++;
++result;
var obj = { set p(arg) { } };
var result;
try { } catch (args) { }
function x(arg) { }
function args() { }
var y = function fun() { };
var f = new Function("args", "return 17;");
function fun() {
if (arguments.length == 0) {
// do something
}
}