I have the following if, else if, else construct and I am just curious how I could convert such as construct into a switch statement.
var emailSubject = email.subject.toLowerCase();
if(emailSubject.indexOf("account request") >= 0){
//do acct req
}else if(emailSubject.indexOf("accounts pending removal for") >= 0){
//do account removal
}else if(emailSubject.indexOf("listserv application") >= 0){
//do listserv app
}else if(emailSubject.indexOf("student organization webmaster transfer request") >= 0){
//do webmaster xfer
}else{
//do default
}
My thoughts are but I do not think this is correct:
switch(emailSubject){
case this.indexOf("account request"):
//do acct request
break;
default:
//do default
}
Or
switch(0){
case emailSubject.indexOf("accounts pending removal"):
//process account pending removal
break;
default:
//do default behavior
}