Home Java Javascript-array JavaScript Array Arguments



JavaScript Array Arguments
Posted on: November 11, 2008 at 12:00 AM
The Argument is an array object that have a property of length which enables the programmer to tell how many arguments (or variables) are passed to the function and specify them, without declaring each argument in the function.

JavaScript Array Arguments

     

The Argument is an array object that have a property of length which enables the programmer to tell how many arguments (or variables) are passed to the function and specify them, without declaring each argument in the function. In the given example, we have passed the arguments in the following way:

days("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

The days.arguments[i] get the specified arguments and displayed on the browser.

Here is the code:

<html>
<head>
<h2> Argument Array Example </h2>
<script language="JavaScript">
function days() {
var items = days.arguments.length
for (i = 0;i < items; i++){
document.write("<li>"+days.arguments[i] );
}

days("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
</script>
</head>
</html>

Output will be displayed as:

Download Source Code

Related Tags for JavaScript Array Arguments:
carrayvariablesfunctionobjectfuniopropertyvariablesedargumentsrialengthprogrammerifuncwithprogramtorameachsseciargumenteitenablevarpemaninpassasmntoutjclesspecwithoutemfuncmehowobjprowhichsspatanyishallproperrayeaandarrtropevassriringthavabablhateclmanyjepropprndonogro


More Tutorials from this section

Ask Questions?    Discuss: JavaScript Array Arguments  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.