Skip to content

Commit 302efee

Browse files
committed
completed 3-paths.js and tested it with logging to the console
1 parent f2ed2f5 commit 302efee

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
1313
const lastSlashIndex = filePath.lastIndexOf("/");
1414
const base = filePath.slice(lastSlashIndex + 1);
15+
1516
console.log(`The base part of ${filePath} is ${base}`);
1617

1718
// Create a variable to store the dir part of the filePath variable
1819
// Create a variable to store the ext part of the variable
1920

20-
const dir = ;
21-
const ext = ;
21+
const dir = filePath.slice(1 , 44);
22+
console.log(dir)
23+
const ext = filePath.slice(lastSlashIndex + 5 );
24+
console.log(ext)
2225

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

0 commit comments

Comments
 (0)