We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

arguments.length Redirect 1


Specifies the number of arguments passed to the function.

Property of arguments
Implemented in JavaScript 1.1
ECMAScript Edition ECMA-262


arguments.length provides the number of arguments actually passed to a function. This can be more or less than the defined parameter count (See Function.length).


Example: Using arguments.length

In this example we are define a function that can add two or more numbers together.

function adder(base, /*, n2, ... */) {
  base = Number(base);
  for (var i = 0; i < arguments.length; i++) {
    base += Number(arguments[i]);
  return base;

See also

Document Tags and Contributors

Last updated by: Sheppy,