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 5d3ef36
Browse filesBrowse the repository at this point in the historyBrowse files
// 1. const penceString = "399p": initialises a string variable with the value "399p"
28
+
//3. we are defining a new variable without the currency at the end that takes a sub string function from the penceString
29
+
//4. the substring starts from index 0
30
+
//5.until lenth of string -1 brfore last character
31
+
//8. adds 0 char to the beginning of string until length is 3
32
+
//9-11 Extracts a substring starting from the beginning of the string and stopping exactly 2 characters from the end
33
+
//14-16 Extracts only the last two characters of the string. The .padEnd(2, "0") appends zeros to the right if the resulting string is somehow shorter than 2 characters
34
+
//18 Uses a template literal to insert the pounds and pence variables into a new string, formatted with a pound symbol and a decimal point, and prints it to the console
0 commit comments