Array declaration with element count : Array Declaration « Array « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="javascript">
<!--
var days_of_week = new Array(7);
days_of_week[0] = "Sunday";
days_of_week[1] = "Monday";
days_of_week[2] = "Tuesday";
days_of_week[3] = "Wednesday";
days_of_week[4] = "Thursday";
days_of_week[5] = "Friday";
days_of_week[6] = "Saturday";
var x = 2;
alert(days_of_week[x]);
//  -->
</script>
</head>
<body>

</body>
</html>








11.2.Array Declaration
11.2.1.Array declaration with element count
11.2.2.Integer Array Declaration with initialization
11.2.3.Initialize a string array during declaration and check the array size
11.2.4.Define two arrays and use for statement to ouput their values
11.2.5.Store strings in array
11.2.6.Output array element in a HTML table format
11.2.7.Paralled array