Skip to content

Commit 930eb80

Browse files
committed
feat(JS) Ensure consistency in parameter names
1 parent ef463c7 commit 930eb80

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

index.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ let screen = document.querySelector("[data-screen]");
33
const operators = document.querySelectorAll("[data-operator]");
44
const operatorRegex = /[\/*\-+]/;
55

6-
7-
8-
9-
10-
116
let data = [];
127

138
btns.forEach((btn) => {
@@ -36,15 +31,10 @@ btns.forEach((btn) => {
3631

3732
convertToPercentage(buttonValue);
3833

39-
userClicksOnEqualButton(buttonValue)
40-
34+
userClicksOnEqualButton(buttonValue);
4135
});
4236
});
43-
44-
// end of forEach() statement
45-
46-
// functions creations
47-
37+
// forEach ends & functions creations begins
4838
function convertToPercentage(button) {
4939
if (button === "%") {
5040
screen.innerText = screen.innerText / 100;
@@ -150,7 +140,7 @@ function insertClosingParenthesis(button) {
150140

151141
function handlingZeroFollowedByAdecimal(button) {
152142
if (Number(button) === 0 && screen.innerText.startsWith("0.")) {
153-
screen.innerText += buttonValue;
143+
screen.innerText += button;
154144
}
155145
}
156146

@@ -174,10 +164,6 @@ function handleNumberButton(button) {
174164
}
175165
}
176166

177-
178-
//////
179-
180-
181167
function userClicksOnEqualButton(button) {
182168
if (button === "=") {
183169
try {
@@ -196,9 +182,7 @@ function userClicksOnEqualButton(button) {
196182
console.log(result);
197183
displayResult(replacedArray, result);
198184
screen.innerText =
199-
result === Infinity
200-
? "You cannot divide by zero. Press AC"
201-
: result;
185+
result === Infinity ? "You cannot divide by zero. Press AC" : result;
202186
// divideByZero(screen, result);
203187
data = [];
204188
data.push(result);
@@ -235,3 +219,4 @@ function displayResult(array, outcome) {
235219
array = [];
236220
array.push(outcome);
237221
}
222+
// functions creations ends

0 commit comments

Comments
 (0)