Skip to content

Commit e6924be

Browse files
committed
feat(JS) refactor code by creating deleteEverythingFromScreen() and pass it in if statement with condition (buttonValue === AC)
1 parent 4691f9c commit e6924be

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ btns.forEach((btn) => {
4747
}
4848

4949
if (buttonValue === "AC") {
50+
deleteEverythingFromScreen();
51+
}
52+
53+
function deleteEverythingFromScreen() {
5054
screen.innerText = "";
5155
data = [];
5256
screen.innerText = 0;
5357
}
58+
5459
if (Number(buttonValue) === 0 && screen.innerText.startsWith("0.")) {
5560
screen.innerText += buttonValue;
5661
}

0 commit comments

Comments
 (0)