Skip to content

Commit 2c37761

Browse files
update_path.js
1 parent 98976cf commit 2c37761

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ console.log(`The base part of ${filePath} is ${base}`);
1818
// Create a variable to store the ext part of the variable
1919

2020

21-
const dir = filePath.slice(0, 34);
21+
const dir = filePath.slice(0, filePath.lastIndexOf("/",lastSlashIndex - 1));
2222
const ext = base.slice(base.lastIndexOf("."));
2323

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

0 commit comments

Comments
 (0)