Skip to content

Commit 908f258

Browse files
Added readability comment, blank line, and fixed header text
1 parent e2053ed commit 908f258

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎Sprint-3/3-mandatory-implement/3-to-pounds.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
// In Sprint-2, there is a program written in 3-mandatory-interpret/3-to-pounds.js
1+
// In Sprint-1, there is a program written in 3-mandatory-interpret/3-to-pounds.js
22

33
// You will need to take this code and turn it into a reusable block of code.
44
// You will need to declare a function called toPounds with an appropriately named parameter.
55

66
// You should call this function a number of times to check it works for different inputs
7+
78
function toPounds(penceString) {
89
const penceStringWithoutTrailingP = penceString.substring(
910
0,
1011
penceString.length - 1
1112
);
12-
13+
// padStart ensures at least 3 digits (e.g., "5" becomes "005")
1314
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
1415
const pounds = paddedPenceNumberString.substring(
1516
0,

0 commit comments

Comments
 (0)