Arrays
-
Array: a collection of data.
-
Accessed by number, called an index, starting with 0, ending with
1 - declaration number.
-
Must be declared before use.
var buildings = new Array(25);
buildings[0] = "Tangeman";
bulidings[1] = "Sawyer";
buildings[2] = "Calhoun";
...
-
Access array element with index number.
-
Arrays and loops go hand in hand.
for (i = 0; i < buildings.length; i++) {
document.write("Building #" + i ": " + building[i]);
}
String Arrays
Home
Internet II: Day 2