… if I have the following constructor and then create an instance of the class:
/* Gallery */
function Gallery( _horseName ){
this.horseName = _horseName
this.pixList = new Array();
}
var touchGallery = new Gallery( "touch" )
… how can I get the Gallery object based on the value of horseName?
Thought about implementing something like:
Gallery.prototype.getGalleryByHorseName = function( _horseName ){ /* to be implemented */}
… but got stuck on that. Is there a cleaner or canonical way to accomplish this? Eventually I’ll have to access that Gallery object in jQuery as well.
Thanks in advance
Simplest solution is to keep your created objects in an object.
Then you can quickly access them by passing a key.