I have some code that looks like this:
TheClass = TheAjaxIndicator.prop('class');
if (TheClass.indexOf('Blue') > 0) { TheHTML = TheHTMLBlue; }
if (TheClass.indexOf('White') > 0) { TheHTML = TheHTMLWhite; }
if (TheClass.indexOf('Green') > 0) { TheHTML = TheHTMLGreen; }
if (TheClass.indexOf('Brown') > 0) { TheHTML = TheHTMLBrown; }
How can I avoid all these if statements?
Thanks.
Example how the code could be written shorter (but not necessarily more efficient) with a regular expression: