Skip to content

Commit 14ba89d

Browse files
create a variable to store both dir(filePath) and ext part of the variable
1 parent 0cad20d commit 14ba89d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ const base = filePath.slice(lastSlashIndex + 1);
1515
console.log(`The base part of ${filePath} is ${base}`);
1616

1717
// Create a variable to store the dir part of the filePath variable
18+
const dir = filePath.slice(0, lastSlashIndex + 1);
19+
1820
// Create a variable to store the ext part of the variable
21+
const lastDotIndex = filePath.lastIndexOf(".");
22+
const ext = filePath.slice(lastDotIndex + 1);
1923

20-
const dir = ;
21-
const ext = ;
24+
// console.log(dir);
25+
// console.log(ext);
2226

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

0 commit comments

Comments
 (0)