JS Calculator showing wrong output

I have build a calculator and it shows following calculation wrong.
Capture

here is my calculate function

function calculate(firstNumber,operator,secondNumber){
    let first=parseFloat(firstNumber);
    let second=parseFloat(secondNumber);
    switch(operator){
        case 'add': return first + second;
        case 'minus': return first - second; 
        case 'multiply': return first * second; 
        case 'divide': return first / second;
    }
}

it’s actually correct, if you want to avoid that you will need to work out the workaround

see this video

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.