I've been trying out this method to tackle the issue, however, my console.log isn't providing the expected output. What adjustments should I make?
const executeCalculator = ({ x, y, operation }) => {
let calculator = {
x: this.x,
y: this.y,
operation: {
"sum": (x, y) => x + y,
"subtract": (x, y) => x - y,
"multiply": (x, y) => x * y,
"divide": (x, y) => x / y,
},
}
if (operation !== 'sum' || 'multiply' || 'subtract' || 'divide') {
console.error('undefined operation');
} else {
return;
};
};
console.log(executeCalculator({
operation: 'sum',
x: 1,
y: 1
}));