-
-
Save jzaefferer/461abb2ccd2be34971ae to your computer and use it in GitHub Desktop.
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 matcher = { | |
"a": f1, | |
"b": f2, | |
_default: f3 | |
}; | |
matcher[input] ? matcher[input]() : matcher._default(); |
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
switch(input) { | |
case "a": f1; break; | |
case "b": f2; break; | |
default: f3; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment