Skip to content

Commit 70f8230

Browse files
committed
Add variable assignment and Implement ext extraction logic in 3-paths.js
1 parent 4eede60 commit 70f8230

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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

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

20+
//Solution
2021
const dir = filePath.slice(0, lastSlashIndex);
2122
console.log(`The dir part of ${filePath} is ${dir}`);
2223

23-
const ext = ;
24+
const lastDotIndex = base.lastIndexOf(".");
25+
const ext = base.slice(lastDotIndex);
2426

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

0 commit comments

Comments
 (0)