Skip to content

Latest commit

 

History

History
76 lines (65 loc) · 2.08 KB

File metadata and controls

76 lines (65 loc) · 2.08 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 Property (Function) (JavaScript) | Microsoft Docs
01/18/2017
windows-client-threshold
devlang-javascript
language-reference
arguments
JavaScript
TypeScript
DHTML
arguments, arguments property
Arguments property
efc7a1ee-0880-4f05-b0f2-808f31a4af1d
13
mikejo5000
mikejo
ghogen

arguments Property (Function) (JavaScript)

Gets the arguments for the currently executing Function object.

Syntax

  
function.arguments  

Remarks

The function argument is the name of the currently executing function, and can be omitted.

This property allows a function to handle a variable number of arguments. The length property of the arguments object contains the number of arguments passed to the function. The individual arguments contained in the arguments object can be accessed in the same way array elements are accessed.

Example

The following example illustrates the use of the arguments property:

function ArgTest(arg1, arg2){  
   var s = "";  
   s += "The individual arguments are: "  
   for (n = 0; n < arguments.length; n++){  
      s += ArgTest.arguments[n];  
      s += " ";  
   }  
   return(s);  
}  
document.write(ArgTest(1, 2, "hello"));  
  
//Output: function ArgTest(arg1, arg2){  
   var s = "";  
   s += "The individual arguments are: "  
   for (n = 0; n < arguments.length; n++){  
      s += ArgTest.arguments[n];  
      s += " ";  
   }  
   return(s);  
}  
document.write(ArgTest(1, 2, "hello"));  
  
// Output: The individual arguments are: 1 2 hello  

Requirements

[!INCLUDEjsv2]

See Also

arguments Object
function Statement