Is it possible to set one object’s key $thumbnailContainer to the value of another object thumbnailImg within the same object gallerySelectors?
Example:
var gallerySelectors = {
'$thumbnailContainer' : $('#thumb'),
'thumbnailImg' : this.$thumbnailContainer.find('img')
};
No, because
thiswill not be bound to the object in the situation you show.I don’t think there is a way to do this.
You could try
but I’m not sure whether I would trust this to work everywhere. I guess you’d have to look into the language spec to see whether the members are always guaranteed to be initialized in order.
I would just take the easy route: