WebDevSimplified / Vanilla-JavaScript-Calculator

Pure vanilla JavaScript calculator using modern ES6 syntax and classes
516 stars 554 forks source link

Divide by zero solution #46

Open khushboo-tolat opened 3 months ago

khushboo-tolat commented 3 months ago

case '÷': if(curr == '0') { compute = '0'; } else{ compute = prev / curr; } break;

Cannot add an error message because for divide by zero as we are using getDisplayNumber() method to edit current operand. Hope this works