Skip to content

Commit 30d58bc

Browse files
changed the variable for the ext part
1 parent 0fded7a commit 30d58bc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ console.log(`The base part of ${filePath} is ${base}`);
1616

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
19+
const lastDotIndex = filePath.lastIndexOf(".");
20+
const ext = filePath.slice(lastDotIndex);
1921

20-
const dir = filePath .slice (0,lastSlashIndex);
21-
console.log(`The dir part of ${filePath} is ${dir}`);
22-
const ext = filePath.slice (lastSlashIndex + 1);
23-
console.log(`The ext part of ${filePath} is ${ext}`);
24-
// https://www.google.com/search?q=slice+mdn
22+
// https://www.google.com/search?q=slice+mdn

0 commit comments

Comments
 (0)