Skip to content

Commit aa8f0fe

Browse files
committed
feat(JS) create zeroDivedByZero()
1 parent b4c7310 commit aa8f0fe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ btns.forEach((btn) => {
8181
console.log(eval(replacedArray .join("")));
8282
displayResult(replacedArray, result);
8383
divideByZero(screen, result);
84+
zeroDivedByZero(screen, result)
8485
data = [];
8586
data.push(result)
8687
} catch (e) {
@@ -93,6 +94,11 @@ btns.forEach((btn) => {
9394
? (display.innerText = "Math Error. Cannot divide by zero")
9495
: (display.innerText = outcome);
9596
}
97+
function zeroDivedByZero(display, outcome) {
98+
isNaN(outcome)
99+
? (display.innerText = "Invalid format: You cannot divided by zero" )
100+
: (display.innerText = outcome)
101+
}
96102
function displayResult(array, outcome) {
97103
array = [];
98104
array.push(outcome);

0 commit comments

Comments
 (0)