Skip to content

Commit d5bf38a

Browse files
removed uneccessary code
1 parent 529c598 commit d5bf38a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const pounds = paddedPenceNumberString.substring(
1111
paddedPenceNumberString.length - 2
1212
);
1313

14-
const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0");
14+
const pence = paddedPenceNumberString.substring(
15+
paddedPenceNumberString.length - 2
16+
);
1517

1618
console.log(${pounds}.${pence}`);
1719

18-
19-
2020
// This program takes a string representing a price in pence
2121
// The program then builds up a string representing the price in pounds
2222

@@ -27,24 +27,24 @@ console.log(`£${pounds}.${pence}`);
2727
// 1. const penceString = "399p": initializes a string variable with the value "399p"
2828

2929
//2. const penceStringWithoutTrailingP = penceString.substring(
30-
// 0,
31-
// penceString.length - 1
32-
// );
33-
//initializes a string variable with the value "399" by removing the last character "p" from penceString
30+
// 0,
31+
// penceString.length - 1
32+
// );
33+
//initializes a string variable with the value "399" by removing the last character "p" from penceString
3434

3535
//3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
36-
//initializes a string variable with the value penceStringWithoutTrailingP, with a minimum length of 3 characters, if it happens to be shorter it will add a "0" at the beginning of the string for every character that is short
36+
//initializes a string variable with the value penceStringWithoutTrailingP, with a minimum length of 3 characters, if it happens to be shorter it will add a "0" at the beginning of the string for every character that is short
3737

3838
//4. const pounds = paddedPenceNumberString.substring(
3939
// 0,
4040
// paddedPenceNumberString.length - 2
41-
// );
42-
//initializes a string variable with the value of paddedPenceNumberString except the final 2 characters, thus extracting the pounds, in this case "3"
41+
// );
42+
//initializes a string variable with the value of paddedPenceNumberString except the final 2 characters, thus extracting the pounds, in this case "3"
4343

4444
//5. const pence = paddedPenceNumberString
4545
// .substring(paddedPenceNumberString.length - 2)
4646
// .padEnd(2, "0")
47-
//it extracts the last two characters (pence) from paddedPenceNumberString and it makes sure that there's always gonna be two by adding "0" at the end
48-
47+
//it extracts the last two characters (pence) from paddedPenceNumberString and it makes sure that there's always gonna be two by adding "0" at the end
48+
4949
//6. console.log(`£${pounds}.${pence}`);
50-
//it logs £3.99
50+
//it logs £3.99

0 commit comments

Comments
 (0)