Skip to content

Commit ed5a315

Browse files
committed
update: step-by-step breakdown of each line in this program
and describe the purpose in sprint -1 of 3-to-pounds.js
1 parent 6992670 commit ed5a315

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ console.log(`£${pounds}.${pence}`);
2424
// Try and describe the purpose / rationale behind each step
2525

2626
// To begin, we can start with
27-
// 1. const penceString = "399p": initialises a string variable with the value "399p"
27+
// 1. const penceString = "399p": initialize a string variable with the value "399p"
28+
//2. Removes the trailing "p" from the string: and result will be 399
29+
//3. Ensures the number has at least 3 digits by padding from the left with zeros: like 000
30+
//4. Extracts the pound portion: "3"
31+
//5.Extracts the pound portion: "99"
32+
//6. Extracts the pound portion: in the standard monetary format of pounds and pence: "£3.99"

0 commit comments

Comments
 (0)