Skip to content

Instantly share code, notes, and snippets.

@jzaefferer
Created Nov 24, 2011
Embed
What would you like to do?
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