Javascript Arguments Object

JavaScript functions have a built-in object called the arguments object.

The argument object contains an array of the arguments used when the function was called (invoked).

This way you can simply use a function to find (for instance) the highest value in a list of numbers:

function func1(a, b, c) {
  // expected output: 1

  // expected output: 2

  // expected output: 3

func1(1, 2, 3);

You can access them as follows:

arguments[0] // first argument
arguments[1] // second argument
arguments[2] // third argument

Each argument can also be set or reassigned:

arguments[1] = 'new value';

Learn More:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top