Best way to deal with global user's choices

edited February 2014 in Programming Questions

Hello,

I am programming an interactive sketch in JavaScript mode. It will display a map.

Basically, the sketch will have a few buttons and according to the one pressed, there will be changes on the map, mostly colors and text.

I don't know how to deal with the way to organize the code according to the choice. My purpose is to keep the code efficient, lightweight (must be loaded on a Web page) and easy to modify.

I am thinking either to use switch/case everytime the code should be different according to the button pressed or to use functions with an int corresponding to the chosen button passed as argument.

What would you do ?

Thank you in advance.

Answers

Sign In or Register to comment.