Skip to content

Commit 6801736

Browse files
committed
rephrase my writing in clearer English
1 parent 89e21be commit 6801736

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ const penceStringWithoutTrailingP = penceString.substring(
55
0,
66
penceString.length - 1
77
);
8-
// declare a new var and assign penceString value without last character (p)/
8+
// Creates a new string that removes the last character (p) from penceString.
99

1010
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
11-
//declare a new variable and Make sure it is at least 3 digits long eg: 1 become 001.
11+
//Ensure the string has at least three digits by adding "0" to the start if needed.
1212

1313
const pounds = paddedPenceNumberString.substring(
1414
0,
1515
paddedPenceNumberString.length - 2
1616
);
17-
//declare a new variable and assign the paddedPenceNumberString value without last two digit.
17+
//Extracts the pounds part by taking all characters except the last two digits.
1818

1919
const pence = paddedPenceNumberString
2020
.substring(paddedPenceNumberString.length - 2)
2121
.padEnd(2, "0");
22-
// pence= take the pound length and remove it and keep all rest digit and if the shorter than 2 digit add 0 until paddedPenceNumberString
23-
// .substring(paddedPenceNumberString.length - 2) becomes 2 digits
22+
//extract the last two digits to get the pence part.
2423
console.log(${pounds}.${pence}`);
24+
// Combines the pound and pence values into a formatted string.
2525

2626
// This program takes a string representing a price in pence
2727
// The program then builds up a string representing the price in pounds

0 commit comments

Comments
 (0)