function calc(x, y, operation) {
var operations = {
plus: function(x, y) { return x + y },
minus: function(x, y) { return x - y },
multiply: function(x, y) { return x * y },
divided: function(x, y) { return x / y },
}
return operations[operation] && operations[operation](x, y);
}
calc(10, 20, "plus"); // 30