I've just discovered the way to create fake 'classes' in javascript, but I wonder how you can store them and still get easy access to their functions in an IDE.
Like this:
function Map(){
this.width = 0;
this.height = 0;
this.layers = new Layers();
}
Now I've got a function that loops through an XML and creates multiple Map() objects. If I store them under a single variable, I can access them just fine, like:
map1 = new Map();
map1.height = 1;
But I don't know under what name they'll be stored! So I thought I could save them like this:
mapArray = {};
mapArray['map1'] = new Map();
But you can't access the functions like this: (At least the IDE code completion won't pick it up)
mapArray['map1'].height = 1;
I then thought this would be the best solution:
function fetch(name){
var fetch = new Map();
fetch = test[name];
}
That way I could write:
fetch('test').height = 1;
But this seems like it'll generate lots of overhead continuously copying variables like that.
Am I overlooking something simple?