Skip to content

Commit 3c63ee6

Browse files
committed
path exercises fixed
1 parent ca8e18f commit 3c63ee6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ console.log(`The base part of ${filePath} is ${base}`);
2020
const dir = filePath.slice(0, lastSlashIndex);
2121
console.log(`The dir part of ${filePath} is ${dir}`);
2222

23-
const ext = base.slice(4);
23+
const lastDotIndex = base.lastIndexOf(".");
24+
const ext = base.slice(lastDotIndex + 1);
2425
console.log(`The ext part of ${filePath} is ${ext}`);
2526

2627

0 commit comments

Comments
 (0)