Skip to content

Instantly share code, notes, and snippets.

@jzaefferer
Created November 24, 2011 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jzaefferer/461abb2ccd2be34971ae to your computer and use it in GitHub Desktop.
Save jzaefferer/461abb2ccd2be34971ae to your computer and use it in GitHub Desktop.
var matcher = {
"a": f1,
"b": f2,
_default: f3
};
matcher[input] ? matcher[input]() : matcher._default();
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