File tree Expand file tree Collapse file tree 3 files changed +6
-18
lines changed Expand file tree Collapse file tree 3 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,4 @@ count = count + 1;
44
55// Line 1 is a variable declaration, creating the count variable with an initial value of 0
66// Describe what line 3 is doing, in particular focus on what = is doing
7- // line 3 returns the incurmented value of count after adding 1 to it and assigns this new value back to count
7+ // line 3 is an assignment which returns the incurmented value of count after adding 1 to it.
Original file line number Diff line number Diff line change 1111
1212const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt" ;
1313const lastSlashIndex = filePath . lastIndexOf ( "/" ) ;
14- const base = filePath . slice ( lastSlashIndex + 1 ) ;
15- console . log ( the base part of ${filePath } is $ { base } ) ;
14+ const base = filePath . slice ( lastSlashIndex + 1 ) ; // file.txt
15+ 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.
1919
20- const dir = filePath . slice ( lastSlashIndex + 1 )
21- const ext = filePath . slice ( lastDotIndexOf ( "." ) + 1 ) ;
20+ const dir = filePath . slice ( 0 , lastSlashIndex )
21+ const ext = filePath . slice ( filePath . lastIndexOf ( "." ) ) ;
2222
23- console . log ( dir )
23+ console . log ( dir , ext )
2424// https://www.google.com/search?q=slice+mdn
Original file line number Diff line number Diff line change @@ -9,16 +9,4 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
99// Try logging the value of num and running the program several times to build an idea of what the program is doing
1010
1111
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22-
23-
2412console . log ( num ) ;
You can’t perform that action at this time.
0 commit comments