Ideally my goal is to have a multi-dimensioned associative array. However it is my understanding that javascript doesn't really do associative arrays.
The data I want to store is a list of 4 digit codes associated with building names. Each building may have a different number of codes. I would like all of the data in one array.
This is the "sudo code", if you will, for how I would like it to come together:
var buildingZaps = [];
buildingZaps['Tall Tower'][] = '3421';
buildingZaps['Tall Tower'][] = '6874';
buildingZaps['Horrendous Hut'][] = '1387';
buildingZaps['Horrendous Hut'][] = '0844';
buildingZaps['Horrendous Hut'][] = '0098';
buildingZaps['Skimpy Skyscraper'][] = '9247';
I tried to do something a little less direct, since the above gave me an error:
var buildingIndexes = [];
var buildingZaps = [];
buildingIndexes['Tall Tower'] = 0;
buildingZaps[0][] = '3421';
buildingZaps[0][] = '6874';
buildingIndexes['Horrendous Hut'] = 1;
buildingZaps[1][] = '1387';
buildingZaps[1][] = '0844';
buildingZaps[1][] = '0098';
buildingIndexes['Skimpy Skyscraper'] = 2;
buildingZaps[2][] = '9247';
This doesn't seem to work either.
Does anyone know a way to get something close to the data structure I am looking for?
Thanks,
David