CKTIS / JavaScript
The arguments object
arguments exposes the arguments supplied to a function call. It has indexed properties and length but is not an array. Parameter aliasing depends on strict mode and the parameter list; arrow functions do not create their own arguments.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
arguments
arguments[index]
arguments.lengtharguments is an object normally available inside a function for its current invocation, not a global variable. arguments[0] reads the first argument, and arguments.length initially gives the number of arguments actually supplied, including extra ones. The name arguments can be shadowed, for example by a function parameter.
The object is array-like, but it is not an array and does not inherit methods such as map. In non-strict mode with a simple parameter list (names only, without defaults, destructuring, or a rest parameter), an index is initially linked to a parameter only if an argument was supplied at the position of that parameter name’s last occurrence in the list. If a name appears more than once, its earlier positions are not linked, even if no argument was supplied at the last position. Where a link exists, assigning on one side can change the value on the other. This is the exotic variant described by the specification.
In strict mode or with a non-simple parameter list, that link does not exist: assigning to a parameter does not update its index in arguments, or vice versa. This does not mean that objects passed as values are copied—both sides can still refer to the same object.
An arrow function does not create its own arguments; the reference is resolved in the enclosing scope. In new code, consider a rest parameter ...args when you need an actual array of arguments. Avoid arguments.callee: accessing it on the unmapped variant throws TypeError.
Examples
function inspect(first) {
"use strict";
first = 99;
const readFirst = () => arguments[0];
console.log(arguments.length);
console.log(readFirst());
console.log(first);
}
inspect(10, 20);Result
2 10 99
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.