Write var area = new Array(); // Introduced in Netscape 3 |
and then you can set as described in Netscape Press book on JavaScript |
area[0] = "Alabama"; |
area[1] = "Alabama"; |
area[2] = "Alaska"; // etc. |
acode[0] = 205; |
acode[1] = 334; |
acode[2] = 907; // mappring area codes to states |
area.length is automatically set as length of array ( 3 in this case) |
Note you can set array elements to be objects to make Arrays of objects |
e.g. listofmenus = new Array(); |
listofmenus[0] = new menuobject(1,'world'); |
worldmenu = listofmenus[0]; // A synonym |