Skip to content

Commit

Permalink
best current version
Browse files Browse the repository at this point in the history
  • Loading branch information
KevVvTheDev committed Sep 2, 2024
1 parent c3d5753 commit 84c9676
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ for(let i = 0; i < operatorButton.length; i++){
//--------------------- This is for clicking equal btn ---------------------
const equalButton = document.querySelector(".equal");
equalButton.addEventListener("click", function(){
if(calculation.operator == null){
return;
}

calculation.secondNum = Number(document.querySelector(".display p").innerHTML);
calculation.result = calculate(calculation.firstNum, calculation.secondNum, calculation.operator);
calculation.operator = null;
Expand Down

0 comments on commit 84c9676

Please sign in to comment.