File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ count = count + 1;
66// Describe what line 3 is doing, in particular focus on what = is doing
77
88//line 3: we are re-assigning count using the assignment operator (=). The " = " is used in JavaScript to assing a value
9- // to a variable and in this case we are re-assinging count to equal count + 1.
9+ // to a variable and in this case we are re-assinging count to equal count + 1.
10+ // we are incrementing count
Original file line number Diff line number Diff line change @@ -17,10 +17,22 @@ console.log(`The base part of ${filePath} is ${base}`);
1717
1818// Create a variable to store the dir part of the filePath variable
1919// Create a variable to store the ext part of the variable
20+ const firstSlash = filePath . indexOf ( "/" ) ;
21+ const period = filePath . indexOf ( "." ) ;
22+ const secondSlash = filePath . indexOf ( "/" , firstSlash + 1 ) ;
23+ const thirdSlash = filePath . indexOf ( "/" , secondSlash + 1 ) ;
24+ const fourthSlash = filePath . indexOf ( "/" , thirdSlash + 1 ) ;
25+ const fifthSlash = filePath . indexOf ( "/" , fourthSlash + 1 ) ;
26+ const sixthSlash = filePath . indexOf ( "/" , fifthSlash + 1 ) ;
27+ const seventhSlash = filePath . indexOf ( "/" , sixthSlash + 1 ) ;
28+ const eighthSlash = filePath . indexOf ( "/" , seventhSlash + 1 ) ;
2029
21- const dir = filePath . slice ( 1 , 44 ) ;
30+
31+
32+
33+ const dir = filePath . slice ( firstSlash , seventhSlash + 1 ) ;
2234console . log ( dir )
23- const ext = filePath . slice ( lastSlashIndex + 5 ) ;
35+ const ext = filePath . slice ( period ) ;
2436console . log ( ext )
2537
2638// https://www.google.com/search?q=slice+mdn
You can’t perform that action at this time.
0 commit comments