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 43a7404 commit fc4edccCopy full SHA for fc4edcc
Sprint-1/1-key-exercises/3-paths.js
@@ -12,12 +12,17 @@
12
const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
13
const lastSlashIndex = filePath.lastIndexOf("/");
14
const base = filePath.slice(lastSlashIndex + 1);
15
+const dir = filePath.slice(0, lastSlashIndex);
16
+const ext = filePath.slice(lastSlashIndex + 5);
17
+
18
console.log(`The base part of ${filePath} is ${base}`);
19
+console.log(`The dir part of ${filePath} is ${dir}`);
20
+console.log(`The ext part of ${filePath} is ${ext}`);
21
22
23
// Create a variable to store the dir part of the filePath variable
24
// Create a variable to store the ext part of the variable
25
-const dir = ;
-const ext = ;
26
27
28
// https://www.google.com/search?q=slice+mdn
0 commit comments