Skip to content

Commit 2dd06dd

Browse files
committed
Correct the answer about padStart and padEnd
1 parent 26d443e commit 2dd06dd

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎Sprint-2/3-mandatory-interpret/3-to-pounds.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ console.log(`£${pounds}.${pence}`);
2929
// : initializes a variable, the value of which is turned to numerical by removing the letter "p".
3030
// 8. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
3131
// Here the padstart function turns "399" string into 399 number (it could add some zeroes in front, but here it serves as a converter)
32+
// Correct answer: Ensures the string is at least 3 characters long by adding leading zeros if needed. With "399", it stays "399". But if the input were "5p", this would become "005".
3233
// 9-12. const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2);
3334
// Here the goal is to initialize a variable of Pounds (with the value of 3), by splitting it from 99, and it's done using the substring method
3435
// 14-16. const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0");

0 commit comments

Comments
 (0)