Skip to content

Latest commit

 

History

History
83 lines (69 loc) · 2.39 KB

File metadata and controls

83 lines (69 loc) · 2.39 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
arguments Object (JavaScript) | Microsoft Docs
01/18/2017
windows-client-threshold
devlang-javascript
language-reference
arguments
JavaScript
TypeScript
DHTML
arguments, arguments object
arguments object
5eb79ca9-bbb8-4a42-aaf5-16a93ecb425f
15
mikejo5000
mikejo
ghogen

arguments Object (JavaScript)

An object representing the arguments to the currently executing function, and the functions that called it.

Syntax

[function.]arguments[n]  

Parameters

function
Optional. The name of the currently executing Function object.

n
Required. The zero-based index to argument values passed to the Function object.

Remarks

You cannot explicitly create an arguments object. The arguments object only becomes available when a function begins execution. The arguments object of the function is not an array, but the individual arguments are accessed the same way array elements are accessed. The index n is actually a reference to one of the 0 n properties of the arguments object.

Example

The following example illustrates the use of the arguments object.

function ArgTest(a, b)  
{  
   var s = "";  
  
   s += "Expected Arguments: " + ArgTest.length;  
   s += "<br />";  
   s += "Passed Arguments: " + arguments.length;  
   s += "<br />";  
  
   s += "The individual arguments are: "  
   for (n = 0; n < arguments.length; n++)  
   {  
      s += ArgTest.arguments[n];  
      s += " ";  
   }  
  
   document.write(s);  
}  
  
ArgTest(1, 2, "hello", new Date())  
  
// Output:  
// Expected Arguments: 2  
// Passed Arguments: 4  
// The individual arguments are: 1 2 hello Tues Jan 8 08:27:09 PST 20xx  

Requirements

[!INCLUDEjsv1]

See Also

0...n Properties (arguments)
callee Property (arguments)
length Property (arguments)