Skip to content

Commit

Permalink
feat(JS): use Number.isFinite() to check that a value is neither Infi…
Browse files Browse the repository at this point in the history
…nity or -Infinity
  • Loading branch information
josueJURE committed Dec 22, 2023
1 parent c504132 commit 4428f0c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ function userClicksOnEqualButton(button) {
let result = eval(replacedArray.join(""));
console.log(result);
displayResult(replacedArray, result);
screen.innerText =
result === Infinity ? "You cannot divide by zero. Press AC" : result;
screen.innerText = !Number.isFinite(result) ? "You cannot divide by zero. Press AC" : result;
// divideByZero(screen, result);
data = [];
data.push(result);
Expand Down

0 comments on commit 4428f0c

Please sign in to comment.