You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 1. const penceString = "399p": initialises a string variable with the value "399p"
29
+
// 3. we are declaring a variable and assigning it the variable penceString which holds the value "399p" but without the p - the method .subString is used
30
+
// here to remove the p.
31
+
// 8. we are declaring a variable and assigning it the variable penceStringWithoutTrailingP which holds the value "399
32
+
// we are then using the .padStart method, however the method will not make any change because we have passed in the argument 3 which i
33
+
// is the total length the string should be after padding - our string is already 3 lengths long.
34
+
// 10. we are using a substring to slice our string from the first index to paddedPenceNumberString.length - 2, paddedPenceNumberString.length
35
+
// will give us the number 3, so paddedPenceNumberString.length - 2 also means 3 - 2 which gives us 1, so from index 0 which is 3 to index 1 which is exclusive.
36
+
// 15. we are declaring a variable pence and assigning it the variable paddedPenceNumberString which holds the result of a couple
37
+
// method chains, firstly a .substring method with the argument "paddedPenceNumberString.length - 2" which also means 3 - 2, so it will
38
+
// slice from index 1 to the end as we have not given a second argument, then we follow with a padEnd, this time we are adding
39
+
// characters to the end of the string - we want a total of two characters
0 commit comments