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
{{ message }}
Repository navigation
Commit 7d4af4e
Browse filesBrowse the repository at this point in the historyBrowse files
//penceString.length - 1 :Removes the letter p from the end of the string.
31
+
//);
32
+
// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); : Makes sure that the string has at least 3 characters by adding zeros at the beginning if required.
// paddedPenceNumberString.length - 2 :This takes the first digit of the number in pence since 100 pence = 1 pound therefore coverting pence to pounds
37
+
// );
38
+
39
+
// const pence = paddedPenceNumberString
40
+
// .substring(paddedPenceNumberString.length - 2): Takes the pence which is the 2 numbers after the 1st number and ensures that it is exactly 2 digits long.
41
+
// .padEnd(2, "0");
42
+
43
+
// console.log(`£${pounds}.${pence}`); : Prints the final output string using the literal to combine currency symbol, pounds and the pence.
0 commit comments