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"
21
+
22
+
// 2. penceStringWithoutTrailingP the last "p" from line 1 is removed
23
+
// substring() method will select a charactor from index 0 to -1, and return the new string "-1 is the last charactor" then we get "399"
24
+
25
+
// 3. paddedPenceNumberString this is assingned to the variable penceStringWithoutTrailingP where a charactor is added to the beggining of the string by the method padStart
26
+
// 3 will add 2 zeros to the begining of the string, we have padStart(3, "0") and we already have three charactor
27
+
// if it was padStart(4, "0") then the result was "0399"
28
+
29
+
// 4. pounds will take the paddedPenceNumberString, select all the charactors exept the last two
30
+
31
+
// 5. pence selects the values in paddedPenceNumberString, then makes sure we have the last we have two digits at the end
0 commit comments