Use for loop to initialize an array : Array Loop « Array « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
var myarray = new Array();
for (i = 0; i < 10; i++)
{
    myarray[i] = i;
}
document.write(myarray);
//  -->
</script>
</head>
<body>

</body>
</html>








11.5.Array Loop
11.5.1.Use for loop to initialize an array
11.5.2.Output all array element with document.write
11.5.3.Use document.write to output the array content
11.5.4.Use for each loop to change the array element value
11.5.5.Array Iteration