We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 465b99f commit 592a934Copy full SHA for 592a934
Sprint-1/1-key-exercises/3-paths.js
@@ -16,8 +16,12 @@ console.log(`The base part of ${filePath} is ${base}`);
16
17
// Create a variable to store the dir part of the filePath variable
18
// Create a variable to store the ext part of the variable
19
+const filePathArray = filePath.split("/");
20
+console.log("filePathArray", filePathArray);
21
+const lastDotIndex = filePath.lastIndexOf(".");
22
-const dir = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file";
-const ext = ".txt";
-
23
+const dir = filePathArray.slice(0,7).join("/");
24
+const ext = filePath.slice(lastDotIndex);
25
+console.log('dir', dir)
26
+console.log('ext', ext)
27
// https://www.google.com/search?q=slice+mdn
0 commit comments