Skip to content

Commit b72751f

Browse files
authored
describing the purpose behind each step of the code
Added comments to explain the purpose of each step in the code.
1 parent 67c8968 commit b72751f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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+
// line 3: calling substring method to remove the 'p' letter and keep only digits in the string
29+
// line 8: using padstart method to make the minimum length of the string to 3 characters by adding one zero or two to the left.
30+
// line 9: using substring method to take only the integer part
31+
// line 14: using substring method to take only the decimal part and padend method to make the minimum length of pence to 2 characters by adding zero to the right
32+
// line 18: calling console function to print the integer part that represents the pound and the decimal part that represents the pence seprated by point

0 commit comments

Comments
 (0)