I would like to make up a 'dimensioned' array holding: shipname, shiptype and year as shown in the example below in such a way that the first line would be 'arrayname0' with one dimension: Bismarck, the second dimension: Battleship, and the last dimension: 1941
arrayname=[
"Bismarck", "Battleship", 1941,
"Prince of Wales", Battleship",1941,
]
Could any of you please show me the syntax for writing this code, and the syntax to withdraw eg. the data "1941" from the first entry.
I would be so grateful :)
var ArrayName = new Array([size|elements]);
Values can be added at defintion or added dynamically
// insert values at start
arrayname = new Array(
["Bismarck", "Battleship", 1941],
["Prince of Wales", "Battleship",1941]
);
// dynamic insert of values
arrayname[2] = (["PT 109", "Patrol", 1941]);
console.println("array elements:");
for (i = 0; i < arrayname.length; i++)
console.println("[" + i + "][0]: " + arrayname[i][0] + " [" + i + "][1]: " + arrayname[i][1] + " [" + i + "][2]: " + arrayname[i][2]);
George Kaiser