File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,15 @@ 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- const dir = ;
21- const ext = ;
20+ //const dir = ;
21+ //const ext = ;
22+
23+ const dir = filePath . slice ( 0 , lastSlashIndex ) ;
24+
25+ const lastDotIndex = filePath . lastIndexOf ( "." ) ;
26+ const ext = filePath . slice ( lastDotIndex ) ;
27+
28+ console . log ( `Dir: ${ dir } ` ) ;
29+ console . log ( `Ext: ${ ext } ` ) ;
2230
2331// https://www.google.com/search?q=slice+mdn
Original file line number Diff line number Diff line change 22
33## What I learned
44- Started Sprint 1 exercises and set up coursework branch
5+ - Learned how to extract directory and extension from a file path using lastIndexOf and slice.
56
67## Errors I hit and what they mean
78-
You can’t perform that action at this time.
0 commit comments