¡@

Home 

2014/10/16 ¤W¤È 12:01:49

jquery Programming Glossary: action.tolowercase

Optimize OR in IF

http://stackoverflow.com/questions/15066671/optimize-or-in-if

Should work in IE7. javascript jquery share improve this question If John always appears the simplest thing is if action.toLowerCase .indexOf john 1 Do something ...but as your question has already changed the values against which you're checking action.. that in the comments String#indexOf if john john beckham john henry giggs john scholes john john messi .indexOf action.toLowerCase Do something Regular expressions if ^ John John Beckham John Henry Giggs John Scholes John John Messi i.exec action Do.. is unlikely to be the best solution if your goal is the fastest result or the least memory use . Or a switch switch action.toLowerCase case john case john beckham case john henry case giggs john case scholes john case john messi Do something Or an object..