Skip to content

Commit 7defa63

Browse files
committed
1-key-exercises comments fixed
1 parent 0180d25 commit 7defa63

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ const 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-
const initials = firstName.charAt(0);
9-
middleName.charAt(0);
10-
lastName.charAt(0);
8+
const initials = `${firstName.charAt(0)}
9+
${middleName.charAt(0)}
10+
${lastName.charAt(0)}`;
1111

1212
console.log(initials);
1313

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// (All spaces in the "" line should be ignored. They are purely for formatting.)
1111

1212
const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
13+
const lastDotIndex = filePath.lastIndexOf(".");
1314
const lastSlashIndex = filePath.lastIndexOf("/");
1415
const base = filePath.slice(lastSlashIndex + 1);
1516
console.log(`The base part of ${filePath} is ${base}`);
@@ -18,7 +19,7 @@ console.log(`The base part of ${filePath} is ${base}`);
1819
// Create a variable to store the ext part of the variable
1920

2021
const dir = filePath.slice(0, lastSlashIndex);
21-
const ext = filePath.slice(-4);
22+
const ext = filePath.slice(lastDotIndex);
2223

2324
console.log(dir);
2425
console.log(ext);

0 commit comments

Comments
 (0)