Store strings in array : Array Declaration « Array « JavaScript Tutorial






<html>
<head>
<title>Store strings in array</title>

</head>
<body>
<P>

<script language="javascript" type="text/javascript">
<!--

var myArray = new Array();
myArray[0] = "AAA";
myArray[1] = "BBB";
myArray[2] = "CCC";
for (var i=0; i<myArray.length; i++) {
  document.write("Element " +i+ " contains: " +myArray[i]+ "<br />");
}

//-->
</script>

</p>

</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