13

Possible Duplicate:
JavaScript or-expression in a switch case

case 'att':
   window.location.replace('/att-Forms.htm');
   break;
case 'at&t':
   window.location.replace('/att-Forms.htm');    
   break;

is there a way to shorten this with some kind of "or" function?

Community
  • 1
  • 1
Rolf
  • 705
  • 2
  • 8
  • 9

2 Answers2

41

Combine the cases

case 'att':
case 'at&t':
    window.location.replace('/att-Forms.htm');    
    break;
epascarello
  • 204,599
  • 20
  • 195
  • 236
15

Just place case statements one after another:

case "att":
case "at&t":
    window.location.replace("/att-Forms.htm");
    break;
VisioN
  • 143,310
  • 32
  • 282
  • 281