Skip to content

Commit 5957240

Browse files
completed task 3
1 parent 84d4de9 commit 5957240

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ let lastName = "Johnson";
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

88
let initials = firstName[0] + middleName[0] + lastName[0];
9-
console.log("The initials are:", initials);
9+
console.log("The initials are", initials);
10+
1011
// https://www.google.com/search?q=get+first+character+of+string+mdn

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ 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 = ;
21-
const ext = ;
20+
const lastDotIndex = filePath.lastIndexOf(".");
21+
const firstSlashIndex = filePath.indexOf("/");
22+
const dir = filePath.slice(firstSlashIndex, lastSlashIndex);
23+
const ext = filePath.slice(lastDotIndex);
24+
console.log("The directory is: ${ext}");
25+
console.log(dir);
2226

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

0 commit comments

Comments
 (0)