I am tyring to do something like this:
this.slides = {$('#Page_1') : null,
$('#Page_2') : null,
$('#Page_3') : null};
Why am I doing this, or what advantage do I gain?
I dont want to use jquery selectors throughout class.
A Solution:
this.slides = [{"key": $('#Page_1'), "value": null},
{"key": $('#Page_2'), "value": null},
{"key": $('#Page_3'), "value": null}];
Limitation:
The problem with this approach is that you have to iterate through the
whole object each time you want to approach this. You should use the
id as identifier, this is much more efficient. – Christoph
Why don’t you try a structure like this:
Or does that break your need for using an object?
Of course, when iterating it, you’d have to use logic like: