Last active
August 29, 2015 14:26
-
-
Save frentsel/a5d1613232c58d9e8e5e to your computer and use it in GitHub Desktop.
RegExp in Switch-Case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var age = 'think'; | |
switch (true) { | |
case (/think/g).test(age): | |
console.log("Think!"); | |
break; | |
default: | |
console.log("not found"); | |
break; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment