Skip to content

Commit 1540cdc

Browse files
committed
3-mandatory-interpret 3-to-pounds.js - added the answers to the question.
1 parent 46f0a14 commit 1540cdc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ 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+
// 3-6. It is taking the vaule from pencestring and using substring to return part of the string, by -1 so from the end resualting in "399"
29+
// 8. It is now adding "0" infront of vaule if the vaule is under 3 characters in size.
30+
// 9-12. Using the substring function to reduce the size of the vaule to just 2 characters.
31+
// 14-16. Taking the value from paddedPenceNumberString and this time with substring, only showing the last 2 characters in teh value.
32+
// Then with using .padEnd it ensures that 2 characters are shown with 0 being there is nothing is there.
33+
// 18. Showing the resualt of the code starting with a "£" then the value of "pounds" then a "." and lastly value of "pence"

0 commit comments

Comments
 (0)