Skip to content

Commit 8424c04

Browse files
committed
made amendments following PR review
1 parent 8db6c55 commit 8424c04

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

Sprint-1/1-key-exercises/2-initials.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ let lastName = "Johnson";
55
// Declare a variable called initials that stores the first character of each string.
66
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
77

8-
let initials = `${
9-
firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0)
10-
}`;
8+
let initials = firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0);
119

1210
// https://www.google.com/search?q=get+first+character+of+string+mdn

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ console.log(`The base part of ${filePath} is ${base}`);
1717
// Create a variable to store the dir part of the filePath variable
1818
// Create a variable to store the ext part of the variable
1919

20-
const dir = filePath.slice(1, lastSlashIndex);
20+
const dir = filePath.slice(0, lastSlashIndex);
2121
const ext = base.split(".").pop();
2222

23+
2324
// https://www.google.com/search?q=slice+mdn

Sprint-1/2-mandatory-errors/3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
// Then try updating the expression last4Digits is assigned to, in order to get the correct value
1717
// by concatenating an empty string the code works as expected
18-
const cardNumber = "" + 4533787178994213;
18+
const cardNumber = (4533787178994213).toString();
1919
const last4Digits = cardNumber.slice(-4);
2020
console.log(last4Digits); // should log '4213'
2121

Sprint-1/3-mandatory-interpret/2-time-format.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ console.log(result);
3434

3535
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
3636

37-
// Yes the code will work for all values of movieLength, because the use of a variable makes it so that the code can be reused for any value of movieLength
37+
// No it will not work for all values. In the case of negative values it will result in a negative time which isn't valid. Also there are certain cases where the remaining minutes or seconds are less than 10, which will make the format look weird e.g 0:3:3 which isn't the standard representation of time. This can be fixed by using the padStart method ensuring there are always 2 digits for hours, minutes and seconds. Additionally if the length passes 24 hours we would need to account for days in the format as that would be more appropriate.

0 commit comments

Comments
 (0)