javascript switch case regex
var regex1 = /a/,
regex2 = /b/,
regex3 = /c/,
samplestring = 'b';
switch (true) {
case regex1.test(samplestring):
console.log("regex1");
break;
case regex2.test(samplestring):
console.log("regex2");
break;
case regex3.test(samplestring):
console.log("regex3");
break;
}
Also in JavaScript:
- how to check if map is map javascript
- js module.exports documentation comments
- javascript create object key from variable
- parsley custom error message
- json-server localhost
- ReferenceError: fs is not defined node js
- swift convert array to json
- boble sorting javascript
- javascript conditional
- adding to array js
- draw rectangle on javascript canvas
- jquery onload event
- express post request body undefined
- render react in blaze
- react documentation
- how to delete an element of an array in javascript
- javascript Count the frequency of a value in an array
- change color by java scribt
- variables 2 python .Bartolome sintes Marco
- javascript add update query parameter to url
- Unterminated quote at columns 0-8 ['MM-yyyy] in expression ['MM-yyyy]
- delay in javascript
- bootstrap 4 form validator with jquery
- node js if no arguments