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

|