I’d like to create a a series of variable like follows that have settings per each:
var panel_myfeed = new Array();
panel_myfeed[0]="/myfeed";
panel_myfeed[1]="#view-panel-myfeed";
panel_myfeed[2]="XXXXXXXX";
var panel_OtherPanel = new Array();
panel_OtherPanel[0]="/otherurl";
panel_OtherPanel[1]="#other-url-panel";
var panel_OtherPanel2 = new Array();
panel_OtherPanel2[0]="/otherurl2";
panel_OtherPanel2[1]=".other-url-panel2";
Then I want to have two separate functions that can use those variables
function WhichPanel(url) {
*** Given a URL var like /myfeed, which which panel[0] this belongs to so I can get the other variables
** do something now that I have the settings above
}
function KillPanel(url) {
*** Given a URL var like /myfeed, which which panel[0] this belongs to so I can get the other variables
** do something now that I have the settings above
}
Suggestions? thxs
It becomes extremely difficult dealing with arrays that way; you have to remember what the indexes represent. It’s much better to have an object with meaningful property names.
Another advantage with this kind of approach is that you can add functions to your class, for example: