Skip to content

Commit fe9563c

Browse files
committed
updated the paths file with my solution
1 parent a2f3b26 commit fe9563c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
1313
const lastSlashIndex = filePath.lastIndexOf("/");
1414
const base = filePath.slice(lastSlashIndex + 1);
1515
console.log(`The base part of ${filePath} is ${base}`);
16+
// console.log('The dir path of ${dir} is ${filePath}.${lastSlashIndex}');
17+
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+
const dir = filePath.slice(0, lastSlashIndex);
23+
const ext = base.slice(base.lastIndexOf("."));
24+
25+
console.log(`The dir part of ${filePath} is ${dir}`);
26+
console.log(`The ext part of ${base} is ${ext}`);
2227

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

0 commit comments

Comments
 (0)