Skip to content

Commit

Permalink
Merge pull request #888 from Abhishantpadam/main
Browse files Browse the repository at this point in the history
Fixed the Issue #783 Multiple Operators in Calculator.
  • Loading branch information
TusharKesarwani committed Jun 8, 2023
2 parents 7b05683 + 25ab8bd commit 70c1e51
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Projects/Calculator/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ for (item of buttons) {
break;

case 'x':
inputValue += '*';
inputValue = eval(inputValue) + '*';
result.innerHTML += '*';
break;

Expand Down Expand Up @@ -93,6 +93,25 @@ for (item of buttons) {
inputValue = result.innerHTML;
break;

case '+':
inputValue = eval(inputValue) + '+';
result.innerHTML += '+';

break;

case '-':
inputValue = eval(inputValue) + '-';
result.innerHTML += '-';

break;


case '/':
inputValue = eval(inputValue) + '/';
result.innerHTML += '/';

break;

default :
inputValue += buttonInput;
result.innerHTML += buttonInput;
Expand Down

0 comments on commit 70c1e51

Please sign in to comment.