Skip to content

Instantly share code, notes, and snippets.

@jspc
Created May 5, 2016 11:03
Show Gist options
  • Save jspc/73afd857d422e2724b4220a4f7c7691f to your computer and use it in GitHub Desktop.
Save jspc/73afd857d422e2724b4220a4f7c7691f to your computer and use it in GitHub Desktop.
var main = function(m, x, y){
{
foo: bar,
baz: quux
}[m](x,y);
}
var bar = function(x,y){
// do something
}
var quux = function(x,y){
// do something else
}
main('foo');
main('baz');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment