Skip to content

Commit bc447ba

Browse files
committed
Further adjustment done on Sprint-1
1 parent 854e79e commit bc447ba

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,22 @@ 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+
//For line 3 and 5 (const penceStringWithoutTrailingP = penceString.substring 0, penceString.length - 1)= substring(start, end) extracts part of a string.
29+
30+
//0 means start at the beginning.
31+
32+
//penceString.length - 1 means stop before the last character.
33+
34+
//For "399p":
35+
36+
//length = 4
37+
38+
//4 - 1 = 3
39+
40+
//substring from 0 to 3 → "399"
41+
42+
// The purpose is to;
43+
44+
//Removes the "p" at the end of the string.
45+
46+
//Leaves only the numeric value "399"

0 commit comments

Comments
 (0)