i want to be able to type map.cube and have it return the pt3arraylocation as a default unless i specify what i want by typing map.cube.poly
for example: map.cube would return [0,0,0] and map.cube.poly would return the object poly in the object cube
You can't do that in JavaScript.
However, as an alternative, it's worth noting that you can add arbitrary properties to arrays if you want to. So for instance:
var map {
cube: [0,0,0],
other: [1,0,0]
};
map.cube.poly = {}; // {} is the same as `new Object()` but not subject to people...
map.other.poly = {}; // ...overriding the `Object` symbol
Then map.cube gives you the array, and map.cube.poly gives you the object you've stored on that array.
How is this possible? Because in JavaScript, arrays aren't really arrays. They're just objects that have an automatic length property, treat a class of property names (all numeric ones) in a special way, and have Array.prototype backing them up. And of course, you can add properties to any object.
There's no literal syntax for doing this, which is why I had to do it with assignments after the object initializer above. But it's perfectly valid. I use it for cross-indexing arrays all the time.
Do be sure, if you do this, that you're not using for..in incorrectly; more.