Skip to content

Commit d6958a1

Browse files
authored
Extract directory and extension from filePath
Added variables to extract directory and extension from filePath.
1 parent 1e39939 commit d6958a1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ console.log(`The base part of ${filePath} is ${base}`);
1616

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
19+
const dir = filePath.slice(0, lastSlashIndex);
20+
console.log(`The direction of the file is ${dir}`);
21+
const ext = filePath.slice(filePath.lastIndexOf(".") + 1);
22+
console.log(`The extenction of the file is ${ext}`);
1923

20-
const dir = ;
21-
const ext = ;
2224

23-
// https://www.google.com/search?q=slice+mdn
25+
// https://www.google.com/search?q=slice+mdn

0 commit comments

Comments
 (0)