1 | In Navigator 3, we write: |
2 | var area = new Array(); |
3 | area[0] = "Alabama"; |
4 | area[1] = "Alabama"; |
5 | area[2] = "Alaska"; // etc. |
6 | var acode = new Array(); |
7 | acode[0] = 205; // mapping area codes to states |
8 | acode[1] = 334; |
9 | acode[2] = 907; |
10 | area.length gives the length of the array ( 3 in this case) |
11 | Note you can set array elements to be objects to make arrays of objects: |
12 | menuArray = new Array(); |
13 | menuArray[0] = new MenuObject(1, 'world'); |
14 | worldMenu = menuArray[0]; // a synonym |