Skip to content

Commit a5cd1c5

Browse files
comment out sprint-1/3-mandatory-interpret/3-to-pounds.js
1 parent e678b92 commit a5cd1c5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Sprint-1/3-mandatory-interpret/3-to-pounds.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
const penceString = "399p";
1+
const penceString = "9p"; //init variable
22

33
const penceStringWithoutTrailingP = penceString.substring(
44
0,
55
penceString.length - 1
6-
);
6+
); //remove p character at the end of the variable
7+
console.log(penceStringWithoutTrailingP);
8+
9+
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); //
10+
console.log(paddedPenceNumberString); //give format of 3 zeroes if the number is less than 3 digits.
711

8-
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
912
const pounds = paddedPenceNumberString.substring(
1013
0,
1114
paddedPenceNumberString.length - 2
12-
);
15+
); //get ponds value conversion changes for given pence
16+
17+
console.log(pounds);
1318

1419
const pence = paddedPenceNumberString
1520
.substring(paddedPenceNumberString.length - 2)
16-
.padEnd(2, "0");
21+
.padEnd(2, "0"); //get the reminds after conversion to pounds
1722

1823
console.log(${pounds}.${pence}`);
1924

0 commit comments

Comments
 (0)