¡@

Home 

2014/10/16 ¤W¤È 12:03:38

jquery Programming Glossary: gro

Refactoring a large block of chained if-else statements

http://stackoverflow.com/questions/3640843/refactoring-a-large-block-of-chained-if-else-statements

seems like overkill and I would like to refactor this...any suggestions if this .text Grocery .type_changer .attr id gro else if this .text Restaurant .type_changer .attr id res else if this .text Bar .type_changer .attr id bar else if this.. .attr id five5 jquery share improve this question Look here if this .text Grocery .type_changer .attr id gro else if this .text Restaurant .type_changer .attr id res else if this .text Bar .type_changer .attr id bar else if this.. .attr id sal You have to think all the repetitions away. What would left over Right the text and id values Grocery gro Restaurant res Bar bar Pizza Delivery piz Quick Service qui Retail ret Salon sal Let hold them in some data structure. An..