There was an error while loading. Please reload this page.
1 parent 9a8d497 commit 7c792eeCopy full SHA for 7c792ee
1 file changed
Sprint-2/1-key-exercises/3-paths.js
@@ -12,10 +12,10 @@
12
const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
13
const lastSlashIndex = filePath.lastIndexOf("/"); //44
14
const base = filePath.slice(lastSlashIndex + 1); //file.txt
15
-console.log(`The base part of ${filePath} is ${base}`);
+//console.log(`The base part of ${filePath} is ${base}`);
16
17
const dir = filePath.slice(0, lastSlashIndex);
18
-const ext = base.slice(4);
+const ext = filePath.slice(-4);
19
console.log(dir);
20
console.log(ext);
21
// https://www.google.com/search?q=slice+mdn
0 commit comments