Name

arguments — NN 3 IE J2 ECMA 1

Synopsis

Read-only

Returns an array of values passed as arguments to the function. The content of the array is independent of the parameter variables defined for the function. Therefore, if the function defines two parameter variables but the calling statement passes 10 parameters, the arguments array captures all 10 values in the order in which they were passed. Statements inside the function may then examine the length of the arguments array and extract values as needed. This allows one function to handle an indeterminate number of parameters if the need arises.

Example

function myFunc()
    for (var i = 0; i < myFunc.arguments.length; i++) {
        ...
    }
}

Value

Array of values of any JavaScript data type.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.