Home Java Javascript-array JavaScript Array Arguments

Related Tutorials


 
 

Share on Google+Share on Google+

JavaScript Array Arguments

Advertisement
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

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 11, 2008

Related Tutorials

Discuss: JavaScript Array Arguments  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com