Javascript-Session 1-Arrays
Creating an array and writing the third element in the array. Online here.
<html>
<head>
<title>Array</title>
</head>
<body>
<h1>Array</h1>
<script language=”JavaScript”>
document.write(”<h2>Output third element</h2>”);
var graphicDesigners=new Array(3);
graphicDesigners[0]=”Woody Pirtle”;
graphicDesigners[1]=”Michael Bierut”;
graphicDesigners[2]=”Paula Scher”;
graphicDesigners[3]=”Michael Gericke”;
graphicDesigners[4]=”Abbott Miller”;
document.write(”1. ” + graphicDesigners[0] + “<br />”);
document.write(”2. ” + graphicDesigners[1] + “<br />”);
document.write(”3. ” + graphicDesigners[2] + “<br />”);
document.write(”4. ” + graphicDesigners[3] + “<br />”);
document.write(”5. ” + graphicDesigners[4] + “<br />”);
document.write(”<br />”);
document.write(”The third element is ” + graphicDesigners[2] + “.”);
</script>
</body>