Skip to content

noArguments

诊断类别:lint/style/noArguments

¥Diagnostic Category: lint/style/noArguments

自从:v1.0.0

¥Since: v1.0.0

来源:

¥Sources:

禁止使用 arguments

¥Disallow the use of arguments.

¥Examples

¥Invalid

function f() {
console.log(arguments);
}
code-block.js:2:16 lint/style/noArguments ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Use the rest parameters instead of arguments.

1 │ function f() {
> 2 │ console.log(arguments);
^^^^^^^^^
3 │ }
4 │

arguments does not have Array.prototype methods and can be inconvenient to use.

¥Valid

function f() {
let arguments = 1;
console.log(arguments);
}

¥Related links