Skip to content

Commit

Permalink
Merge pull request #15 from josueJURE/history
Browse files Browse the repository at this point in the history
History
  • Loading branch information
josueJURE authored Dec 25, 2023
2 parents 376c3eb + 16d5f3f commit 6e9f631
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const operators = document.querySelectorAll("[data-operator]");
const operatorRegex = /[\/*\-+]/;
const ZERO = 0;
const ZERO_DOT = '0.';
const history = [];

let data = [];

Expand Down Expand Up @@ -181,7 +182,10 @@ function userClicksOnEqualButton(button) {
screen.innerText = "0÷0 is an invalid format. Press AC";
} else {
let result = eval(replacedArray.join(""));
console.log(result);
replacedArray.splice(replacedArray.length, 0, "=", result);
history.push(replacedArray.join(""))
console.log(history);

displayResult(replacedArray, result);
screen.innerText = !Number.isFinite(result) ? "You cannot divide by zero. Press AC" : result;
// divideByZero(screen, result);
Expand Down

0 comments on commit 6e9f631

Please sign in to comment.