I have this code:
var params = Spry.Utils.getLocationParamsAsObject();
theLeague = params.league;
switch (theLeague)
{
case 'boyswinter':
var Soccer = new Spry.Widget.TabbedPanels("Soccer", {defaultTab: 0});
break;
case 'girlswinter':
var Soccer = new Spry.Widget.TabbedPanels("Soccer", {defaultTab: 1});
break;
default:
var Soccer = new Spry.Widget.TabbedPanels("Soccer", {defaultTab: 0});
}
I’d like to use an alternative to switch, and I found this bit of code to use as a guide:
var whatToBring = {
"Sunny" : "Sunscreen and hat",
"Rain" : "Umbrella and boots",
"Cold" : "Scarf and Gloves",
"Default" : "Play it by ear"
}
var gear = whatToBring[weather] || whatToBring["Default"];
However, I can’t figure out how to swap in my stuff so that it works. It should be easy, but as a JS beginner, I can’t wrap my head around it. Any help would be greatly appreciated. Thanks.
I don’t know if using an object is the best method here, but in any event, this should work.