File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,14 @@ 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 = filePath ;
21+ filePath . slice ( 0 , lastSlashIndex ) ;
22+ const ext = filePath ;
23+ filePath
24+ . slice ( lastSlashIndex + 1 )
25+ . split ( "." )
26+ . pop ( ) ;
27+ // The code above uses the lastIndexOf method to find the position of the last slash in the filePath string.
28+ // The slice method is then used to extract the base part of the filePath string, which is the part after the last slash.
2229
23- // https://www.google.com/search?q=slice+mdn
30+ // https://www.google.com/search?q=slice+mdn
You can’t perform that action at this time.
0 commit comments