Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I Combine Multiple Cases? [duplicate]

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?

like image 926
Rolf Avatar asked Jan 08 '13 18:01

Rolf


2 Answers

Combine the cases

case 'att':
case 'at&t':
    window.location.replace('/att-Forms.htm');    
    break;
like image 154
epascarello Avatar answered Oct 11 '22 20:10

epascarello


Just place case statements one after another:

case "att":
case "at&t":
    window.location.replace("/att-Forms.htm");
    break;
like image 38
VisioN Avatar answered Oct 11 '22 20:10

VisioN