File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,17 @@ const base = filePath.slice(lastSlashIndex + 1);
1515console . log ( `The base part of ${ filePath } is ${ base } ` ) ;
1616
1717// Create a variable to store the dir part of the filePath variable
18- // Create a variable to store the ext part of the variable
18+
1919
2020const dir = filePath . slice ( 0 , lastSlashIndex ) ; // The code uses the lastIndexOf method to find the position of the last slash in;
2121console . log ( `The dir part of ${ filePath } is ${ dir } ` ) ;
2222filePath . slice ( 0 , lastSlashIndex ) ;
23- const ext = filePath ;
23+
2424filePath
2525 . slice ( lastSlashIndex + 1 )
2626 . split ( "." )
2727 . pop ( ) ;
28- // The code above uses the lastIndexOf method to find the position of the last slash in the filePath string.
29- // The slice method is then used to extract the base part of the filePath string, which is the part after the last slash.
28+ // Create a variable to store the ext part of the variable
29+
30+ const ext = base . slice ( base . lastIndexOf ( "." ) + 1 ) ;
31+ console . log ( `The ext part of ${ filePath } is ${ ext } ` ) ;
You can’t perform that action at this time.
0 commit comments