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 6f289e8 commit 0dfa642Copy full SHA for 0dfa642
Sprint-1/1-key-exercises/3-paths.js
@@ -17,10 +17,9 @@ console.log(`The base part of ${filePath} is ${base}`);
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
20
-const dir = filePath.slice(0, lastSlashIndex + 1);
21
-const ext = filePath.slice(-3); //the extention of the file is always the last three characters in the path
22
-//or
23
-//const lastPointIndex = filePath.lastIndexOf(".");
24
-//const ext = filePath.slice(lastPointIndex+1);
+const dir = filePath.slice(0, lastSlashIndex);
+
+const lastPointIndex = filePath.lastIndexOf(".");
+const ext = filePath.slice(lastPointIndex + 1);
25
26
// https://www.google.com/search?q=slice+mdn
0 commit comments