javascript - get Object based on property's value
<p>... if I have the following constructor and then create an instance of the class:</p>

<pre><code>    /* Gallery */
function Gallery( _horseName ){
    this.horseName = _horseName
    this.pixList = new Array();
}

var touchGallery = new Gallery( "touch" )
</code></pre>

<p>... how can I get the Gallery object based on the value of horseName?</p>

<p>Thought about implementing something like: </p>

<pre><code>Gallery.prototype.getGalleryByHorseName = function( _horseName ){ /* to be implemented */}
</code></pre>

<p>... 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.</p>

<p>Thanks in advance</p>
