Skip to content

Commit aef0c07

Browse files
committed
Did Mandatory Intepret tasks on 3 files of sprint 1
1 parent 9dcebe9 commit aef0c07

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Sprint-1/3-mandatory-interpret/3-to-pounds.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,24 @@ const penceStringWithoutTrailingP = penceString.substring(
3030
0,
3131
penceString.length - 1
3232
) : calculate the length and then subtract 1,length is 4-1=3 , and extract substring 0 to 3 i.e 399
33-
/*
33+
3434
line 8.Padstart puts zero in beginning until it meets the desire length. The length is 3 and string length is already 3, so it remained unchanged.
3535
paddedPenceNumberString = "399"
36+
3637
line 9-12.
3738
const pounds = paddedPenceNumberString.substring(
3839
0,
3940
paddedPenceNumberString.length - 2
4041
); paddedPenceNumberString.length - 2: 3-2=1 -> paddedPenceNumberString.substring(0,1)-> pounds="3"
41-
line 14-16.
42+
l
43+
ine 14-16.
4244
const pence = paddedPenceNumberString
4345
.substring(paddedPenceNumberString.length - 2)
4446
.padEnd(2, "0");
4547
(paddedPenceNumberString.length - 2)-> 3-2 = 1 -> substring(1).padEnd(2,"0")-> 99, the length is already two.
4648
pence ="99"
4749
50+
line 18.
4851
console.log(`£${pounds}.${pence}`);
4952
£3.99
5053
*/

0 commit comments

Comments
 (0)