Using || in javascript switches
javascript
Solution
Close, but this will work:
switch (rule)
{
case 'email':
case 'valid_email':
valid = this.validate_email(field);
break;
}
The reason why it works is that without a `break;`, execution continues within the `switch` block.
Problem
Is this code possible? ``` switch (rule) { case 'email' || 'valid_email': valid = this.validate_email(field); break; } ```