Mega Code Archive

 
Categories / JavaScript DHTML / Language Basics
 

Displaying the Contents of an Array

<script language="JavaScript1.1" type="text/javascript"> <!--   var coffee = new Array();   coffee[0] = "E";   coffee[1] = "K";   coffee[2] = "C";   coffee[3] = "S";   coffee[4] = "C";   coffee[5] = "Z";   coffee[6] = "B";       document.write("Coffees of the World:<p>");   for (var i = 0; i < coffee.length; i++) {     document.write(i + 1 + ". " + coffee[i] + "<br>");   }   document.write('</p>'); //--> </script>