Skip to content

Commit ea7dbc1

Browse files
committed
Add detailed explanation for penceStringWithoutTrailingP processing in 3-to-pounds.js
1 parent 6f6bcad commit ea7dbc1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎Sprint-2/3-mandatory-interpret/3-to-pounds.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ console.log(`£${pounds}.${pence}`);
2525

2626
// To begin, we can start with
2727
// 1. const penceString = "399p": initialises a string variable with the value "399p"
28+
29+
// 2. const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1);
30+
// substring(0, length - 1): is a method that is invoked in the paragraph above to take every character in the string provided except the last one, leaving out the 'p'
31+
// That is -> '399p' becomes '399'
32+
// const penceStringWithoutTrailingP: used to store the value from 'penceString.substring(...)'
33+

0 commit comments

Comments
 (0)