We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c374aa commit c8dcc85Copy full SHA for c8dcc85
index.js
@@ -94,11 +94,16 @@ btns.forEach((btn) => {
94
? (display.innerText = "Math Error. Cannot divide by zero")
95
: (display.innerText = outcome);
96
}
97
- function zeroDivedByZero(display, outcome) {
98
- Number.isNaN(outcome)
99
- ? (display.innerText = "0÷0 is an nvalid format press AC" )
100
- : (display.innerText = outcome)
+
+ function hasZeroDividedByZero(array) {
+ for (let i = 0; i < array.length - 2; i++) {
+ if (array[i] === "0" && array[i + 1] === "/" && array[i + 2] === "0") {
101
+ return true;
102
+ }
103
104
+ return false;
105
106
107
function displayResult(array, outcome) {
108
array = [];
109
array.push(outcome);
0 commit comments