Use for statement to loop through all elements in an array : For Loop : Statement JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Statement » For Loop »

 

Use for statement to loop through all elements in an array

















<html>
<head>
<title>Use for statement to loop through all elements in an 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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Statement
» For Loop