Hopefully my title explains it but I need a function that will take 3 arguments (two numbers and an operator [*, +, /, -]), then compute the result.
Something like this:
function evaluateExpression (firstNum, secondNum, operator) {
...
return ...;
}
evaluateExpression (35, 7, '/'); // should return 5
Pseudocode:
evaluateExpression( first, second, op ) :
if op == "+" :
return first + second
else if op == "*" :
return first * second
... etc
else :
return error