Skip to content

Commit 71e889b

Browse files
committed
added directory variable for file path
1 parent c8979e7 commit 71e889b

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@
1010
// (All spaces in the "" line should be ignored. They are purely for formatting.)
1111

1212
const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
13-
const lastSlashIndex = filePath.lastIndexOf("/");
14-
const base = filePath.slice(lastSlashIndex + 1);
13+
const lastSlashIndex = filePath.lastIndexOf("/"); //44
14+
const base = filePath.slice(lastSlashIndex + 1); //file.txt
1515
console.log(`The base part of ${filePath} is ${base}`);
1616

17-
// Create a variable to store the dir part of the filePath variable
18-
// Create a variable to store the ext part of the variable
17+
const dir = filePath.slice(0, lastSlashIndex);
1918

20-
const dir = ;
21-
const ext = ;
22-
23-
// https://www.google.com/search?q=slice+mdn
19+
// https://www.google.com/search?q=slice+mdn

0 commit comments

Comments
 (0)