Might sound funny.. but ya.. i liked what i did today, so thought of sharing it..
The immediate refactoring was to use array to create options for the combo box. So i created a function which was called on body OnLoad event which would fill the select html element.
- The function would make no sense, as in imagine a developer checking this code, he would be confused as to where all this function is used.
- Debugging is easier. You don’t have to go to head to check your function, rather can just write the js code where ur html element is.
The disadvantages(as mentioned by Kirit Pamar):