Skip to content

Commit bb1e2e0

Browse files
committed
Fixed dir and ext calculation
1 parent 42e81a7 commit bb1e2e0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

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

2020

2121

22-
const dir = filePath.slice(base, -9);
23-
const ext = filePath.slice(-4);
22+
const dir = filePath.slice(0, lastSlashIndex);
23+
const ext = filePath.slice(filePath.lastIndexOf("."), filePath.length);
2424

25+
console.log(dir)
2526
console.log(ext)
2627

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

0 commit comments

Comments
 (0)