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-6. It makes a new string penceStringWithoutTrailingP containing all the characters of penceString except the last one which is the trailing character "P". It uses the substring() method by specifying the start and end indexes.
30
+
// 8. It makes a new variable called paddedPenceNumberString, and then stores the result of calling padStart on the previous variable which is penceStringWithoutTrailingP. This adds zeros at the beginning of the string if its less than three characters.
31
+
// 10. It makes a new variable called pounds, it takes paddedPenceNumberString and removes the last two characters. So the value of pounds is three.
32
+
// 15. It makes a new variable called pence. It takes paddedPenceNumberString and takes the last two characters, if its less than two characters it will pad it with zeros until its two characters. So the result is 99.
33
+
// 19. It console logs pounds and pence together as one string with a pound sign.
0 commit comments