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 @@ -31,10 +31,11 @@ console.log(`£${pounds}.${pence}`);
3131// In line 3-6, Another variable "penceStringWithoutTrailingP" was created to remove the trainling "p".
3232// That is, taking off the "p" in '399p' leaving it at just "399".
3333
34- // Also, line 3-6 used the function substring(0, penceString.lrength - 1) to cut out the "p" in the "penceString" variable.
35- // By starting count fron 0 (beginnning) of "399p".
36- // "Using penceString.lenght - 1" to check the length of the value in the variable penceString = "399p" (4),
37- // And deducting 1 from the value (4 - 1), because length - 1 subtract 1 from the character/value count 4. leaving the value at "399"
34+ // 3-6. substring(0, penceString.length - 1):
35+ // the first argument is the start index, so 0 means the first character
36+ // penceString.length is 4 because there are 4 characters, at indexes 0 to 3
37+ // the second argument is the end index and it is exclusive, it stops just before that position
38+ // length - 1 is 3, so it stops before index 3, dropping the "p" and leaving "399"
3839
3940// Line 8 a variable "paddedPenceNumberString" was created and a function padStart(3, "0")
4041// was used to ensure the value of the variable remains at 3 and to be filled with "0" at the beginning if the value is less 3
You can’t perform that action at this time.
0 commit comments