I'm trying to create (or simulate) an infinite-dimensional array in JavaScript. Essentially, this would be an data structure that would associate objects with lists of integers (which could be of any length). Is there an efficient way to store each element in this data structure?
function addElement(theObject, coordinates){
//object is the object, and coordinates is the list of coordinates (any number of coordinates will be accepted, since it's infinite-dimensional)
}
function getObject(coordinates){
//get the object that was previously assigned to this list of coordinates
}
addElement("Hello World", [0, 0, 3, 5]);
console.log(getObject([0, 0, 3, 5])); //this would print "Hello World".