Skip to content

Instantly share code, notes, and snippets.

@heinthanth
Created September 1, 2019 03:31
Show Gist options
  • Save heinthanth/d429b62cc826f486e556cf768bd43888 to your computer and use it in GitHub Desktop.
Save heinthanth/d429b62cc826f486e556cf768bd43888 to your computer and use it in GitHub Desktop.
Switch with Multiple Condition
var x = "bar";
switch(x) {
case "foo":
case "bar":
// will execute if x is either "foo" or "bar"
break;
case "baz":
// will execute if x is neither "foo" nor "bar"
break;
default:
// will execute if x is not each of all above
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment