File tree Expand file tree Collapse file tree
Sprint-2/3-mandatory-interpret Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,3 +25,11 @@ 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+ // 2. const penceStringWithoutTrailingP = "399": returning with shorten less index to erase p
29+ // 3. const paddedPenceNumberString = "399"; It pads the string with the given length with specific string.
30+ // In this case, penceStringWithoutTrailingP (399) is already with 3 digis, so no change.
31+ // 4. const pounds = "3", getting part of the string by subString and target to get the string without last 2 digis.
32+ // 5. const pence = "99", subString indexStart counted by length of paddedPenceNumberString - 2 that is 1. So the result of
33+ //subString is 99. padEnd result the string with given length from the end of String. "99" length is 2 and already match
34+ //with the function. no change.
35+ //6. console.log = £3.99. The number refer to pounds and pence.
You can’t perform that action at this time.
0 commit comments