Skip to content

Commit 3d908a8

Browse files
committed
feat(JS) create handlingZeroFollowedByAdecimal()
1 parent fdefee3 commit 3d908a8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ btns.forEach((btn) => {
2121
userClicksOnEqualButton(buttonValue);
2222

2323

24-
if (Number(buttonValue) === 0 && screen.innerText.startsWith("0.")) {
25-
screen.innerText += buttonValue;
26-
}
24+
handlingZeroFollowedByAdecimal(buttonValue)
25+
26+
27+
2728
if (!isNaN(Number(buttonValue))) {
2829
screen.innerText = buttonValue;
2930
data.push(screen.innerText);
@@ -215,3 +216,9 @@ function insertClosingParenthesis(button) {
215216
screen.innerText = data.join("");
216217
}
217218
}
219+
220+
function handlingZeroFollowedByAdecimal(button) {
221+
if (Number(button) === 0 && screen.innerText.startsWith("0.")) {
222+
screen.innerText += buttonValue;
223+
}
224+
}

0 commit comments

Comments
 (0)