Skip to content

Commit 8a27562

Browse files
committed
Complete file path task
1 parent b04b242 commit 8a27562

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111

1212
const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
1313
const lastSlashIndex = filePath.lastIndexOf("/");
14+
//console.log(lastSlashIndex);
1415
const base = filePath.slice(lastSlashIndex + 1);
15-
console.log(`The base part of ${filePath} is ${base}`);
16+
//console.log(base)
17+
//console.log(`The base part of ${filePath} is ${base}`);
1618

1719
// Create a variable to store the dir part of the filePath variable
1820
// Create a variable to store the ext part of the variable
1921

20-
const dir = ;
21-
const ext = ;
22-
22+
const dir = filePath.slice(0, lastSlashIndex);
23+
const ext = filePath.slice(filePath.lastIndexOf("."));
24+
console.log(dir);
25+
console.log(ext);
2326
// https://www.google.com/search?q=slice+mdn

0 commit comments

Comments
 (0)