index.js
// selects the correct case and performs the correct calculation depending on the operands
selects the correct case and performs the correct calculation depending on the operands
selects the correct case and performs the correct calculation depending on the operands
function calculateSetOperation() {
  const operation = operations.find((e) => e.operator === operator);
  if (operation) {
    result = operation.fn(operand1, operand2);
  }
  if (result === null) {
    console.error('Not implemented or is not a mathematical operator:', operator);
    console.log('Supported operators are: + , - , / , * , p (power) and % (modulo).');
  } else {
    console.log('Result:', result);
  }
}
function calculateSetOperation ( ) { const operation = operations . find ( ( e ) => e . operator === operator ) ; if ( operation ) { result = operation . fn ( operand1 , operand2 ) ; } if ( result === null ) { console . error ( 'Not implemented or is not a mathematical operator:' , operator ) ; console . log ( 'Supported operators are: + , - , / , * , p (power) and % (modulo).' ) ; } else { console . log ( 'Result:' , result ) ; } }
selects the correct case and performs the correct calculation depending on the operands
selects the correct case and performs the correct calculation depending on the operands