Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Better way to approach this Switch or Array scenario?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #42747
    yeeyang
    Participant

    Hi everyone… pretty newbie at Javascript and Jquery and am trying to get better.

    I have a situation where I have two sets of buttons, one containing 5 buttons, the other containing 3 buttons. I have to do a mix n’ match kind of page where if you pick one option, the page background and other elements (mainly images) will change base on the selections. Since I have two sets of buttons, I’ll have 15 different possibilities.

    Since I’m not very good at this kind of stuff… I did a switch-case as a prototype so you can see where I’m going with this. I don’t know how to structure an array to handle this kind of thing, so I guess that is part of my question.

    Is what I have currently the ‘best’ solution or would structuring this into an array object be better?

    My Pen: [http://codepen.io/ahabion/pen/Eqyoc](http://codepen.io/ahabion/pen/Eqyochttp://codepen.io/ahabion/pen/Eqyoc”)

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.