Skip to content

Commit 231eb34

Browse files
committed
fixed pr comments
1 parent 3694314 commit 231eb34

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Sprint-1/1-key-exercises/3-paths.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const filePathArray = filePath.split("/");
2020
console.log("filePathArray", filePathArray);
2121
const lastDotIndex = filePath.lastIndexOf(".");
2222

23-
const dir = filePathArray.slice(0,7).join("/");
23+
const dir = filePathArray.slice(0,-1).join("/");
2424
const ext = filePath.slice(lastDotIndex);
2525
console.log('dir', dir)
2626
console.log('ext', ext)

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ const penceStringWithoutTrailingP = penceString.substring(
44
0,
55
penceString.length - 1
66
);
7-
console.log("penceStringWithoutTrailingP",penceStringWithoutTrailingP)
7+
8+
console.log("penceStringWithoutTrailingP", penceStringWithoutTrailingP);
89
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
9-
console.log("paddedPenceNumberString",paddedPenceNumberString)
10+
console.log("paddedPenceNumberString", paddedPenceNumberString);
1011
const pounds = paddedPenceNumberString.substring(
1112
0,
1213
paddedPenceNumberString.length - 2
1314
);
14-
console.log("pounds",pounds)
15+
console.log("pounds", pounds);
1516
const pence = paddedPenceNumberString
1617
.substring(paddedPenceNumberString.length - 2)
1718
.padEnd(2, "0");
18-
console.log("pence",pence)
19+
console.log("pence", pence);
1920
console.log(${pounds}.${pence}`);
2021

2122
// This program takes a string representing a price in pence
@@ -27,7 +28,7 @@ console.log(`£${pounds}.${pence}`);
2728
// To begin, we can start with
2829
// 1. const penceString = "399p": initialises a string variable with the value "399p"
2930
// 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+
// 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.
3132
// 10. It makes a new variable called pounds, it takes paddedPenceNumberString and removes the last two characters. So the value of pounds is three.
3233
// 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.
34+
// 19. It console logs pounds and pence together as one string with a pound sign.

0 commit comments

Comments
 (0)