Skip to content

Commit 11f2fe4

Browse files
authored
Enhance code readability with explanatory comments
Added comments to explain the purpose of each step in the code.
1 parent 4340677 commit 11f2fe4

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ console.log(`£${pounds}.${pence}`);
2525

2626
// To begin, we can start with
2727
// 1. const penceString = "399p": initialises a string variable with the value "399p"
28+
// [ChunYanWong] line 3 is used to remove the character "p" or the unit penny
29+
// [ChunYanWong] line 8 is used to add three 0 in front of the variable penceStringWithoutTrailingP
30+
// [ChunYanWong] line 9 is used to get the nearest pound from the variable above
31+
// [ChunYanWong] line 14 is used to get the remaining penny after converting to the nearest pound
32+
// [ChunYanWong] line 18 is used to display the result in pound and penny respectively

0 commit comments

Comments
 (0)