Skip to content

Commit 4260fda

Browse files
updated code to store the ext part
1 parent 9adaffa commit 4260fda

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ console.log(`The base part of ${filePath} is ${base}`);
1919
// Create a variable to store the dir part of the filePath variable
2020
// Create a variable to store the ext part of the variable
2121

22+
2223
const dir = filePath.slice(0,lastSlashIndex);
23-
const ext = filePath.slice(lastDotIndex+1);
24+
const ext = filePath.slice(filePath.lastIndexOf(".") + 1);
25+
2426

2527

2628
// https://www.google.com/search?q=slice+mdn

0 commit comments

Comments
 (0)