File tree Expand file tree Collapse file tree 6 files changed +32
-9
lines changed
Expand file tree Collapse file tree 6 files changed +32
-9
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ count = count + 1;
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
77Answer
8- // Line 3; when we the right side first count in the right side is considerd as 0 so 0+1 will be 1.
9- // But the = sign does not mean the mathimatical equal, its function is to take the result on the right and store it on the left.
10- // Therfore if we write the same code in next line the result is not one but 2
8+ // Line 3; when we the right side first count in the right side is considered as 0 so 0+1 will be 1.
9+ // But the = sign does not mean the mathematical equal, its function is to take the result on the right and store it on the left.
10+ // Therefore if we write the same code in next line the result is not one but 2
Original file line number Diff line number Diff line change @@ -17,7 +17,9 @@ 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 . slice ( 0 , lastSlashIndex ) ;
21+ const lastDotIndex = base . lastIndexOf ( "." ) ;
22+ const ext = base . slice ( lastDotIndex + 1 ) ;
23+
2224
2325// https://www.google.com/search?q=slice+mdn
Original file line number Diff line number Diff line change @@ -7,3 +7,22 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
77// Try breaking down the expression and using documentation to explain what it means
88// It will help to think about the order in which expressions are evaluated
99// Try logging the value of num and running the program several times to build an idea of what the program is doing
10+
11+ // Answer
12+
13+ // 1.
14+ // The num in this scenario represent any integer between 1 and 100
15+
16+ // 2.
17+ // Math.floor: rounds the number down to the nearest whole number which means it ignores the number to the right of the point. eg. 4.7=4
18+ // Math.random is a js code that returns any random number that is greater than or equal to 0 and less than 1
19+ //* is multiplication
20+ // maximum is the maximum given number, in this case 100
21+ //- is a subtraction
22+ // minimum is the minimum given number, in this case 1
23+ //(maximum - minimum +1) this is subtracting the minimum number from the maximum and add 1, in this case (100-1+1)=100
24+ //+ minimum: this turns the value by adding 1 to the whole equation.
25+
26+ //3.
27+
28+ console . log ( num )
Original file line number Diff line number Diff line change 1- This is just an instruction for the first activity - but it is just for human consumption
2- We don 't want the computer to run these 2 lines - how can we solve this problem?
1+ // This is just an instruction for the first activity - but it is just for human consumption
2+ // We don't want the computer to run these 2 lines - how can we solve this problem?
Original file line number Diff line number Diff line change 11// trying to create an age variable and then reassign the value by 1
22
3- const age = 33 ;
3+ let age = 33 ;
44age = age + 1 ;
5+ console . log ( age )
Original file line number Diff line number Diff line change 11// Currently trying to print the string "I was born in Bolton" but it isn't working...
22// what's the error ?
33
4- console . log ( `I was born in ${ cityOfBirth } ` ) ;
4+
55const cityOfBirth = "Bolton" ;
6+ console . log ( `I was born in ${ cityOfBirth } ` ) ;
You can’t perform that action at this time.
0 commit comments