Is this code possible?
switch (rule) { case 'email' || 'valid_email': valid = this.validate_email(field); break; }
Close, but this will work:
switch (rule) { case 'email': case 'valid_email': valid = this.validate_email(field); break; }
The reason it works is because no break;execution continues in the block switch.
break;
switch
No, this is not possible; Switch statements do not perform arithmetic calculus.
However, you can use the case chain or the if group:
Source: https://habr.com/ru/post/1712244/More articles:Removing dynamically created controls - .netDifference between StaticName and InternalName (in class SPField) - sharepointHow do I post a video via the Facebook Connect API to my page in my Facebook profile? - postUsing WebParts in an MVC Application - asp.net-mvcSOAP web service consumption, error while de-serializing value types - soapHow to convert OO Perl to Java? - javaMake one Gridview field a selection link? - c #Как настроить контроллер представления в качестве делегата для двух вещей (например, LocationManager и Accelerometer)? - iphoneCygwin GDB gives error 193 when trying to run a program - c ++ORM and database limitations - databaseAll Articles