'use strict' let num1 = document.getElementById("input1") let num2 = document.getElementById("input2") let operator = document.getElementById("operator") let result = document.getElementById("result") function FindOperator(operat){ let OperatorVal = operat switch(OperatorVal){ case "+": return "add" case "-": return "subtract" case "/": return "divide" case "*": return "multiply" } } function calculate(){ let number1 = num1.value let number2 = num2.value let oper = FindOperator(operator.value) fetch(`http://localhost:8080/${oper}/${number1}/${number2}`) .then(response => response.text()) .then(data => {result.value = data}) }