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,4 @@ count = count + 1;
66// Describe what line 3 is doing, in particular focus on what = is doing
77
88//= mean assignment operator. Computer will calculate the result of "count + 1" and update the variable with the result.
9- //In this question, variable "count" changed from 0 to 1.
9+ //In this question, variable "count" changed from 0 to 1.
Original file line number Diff line number Diff line change @@ -8,4 +8,4 @@ const lastName = "Johnson";
88const initials = `${ firstName . charAt ( 0 ) } ${ middleName . charAt ( 0 ) } ${ lastName . charAt ( 0 ) } ` ;
99
1010// https://www.google.com/search?q=get+first+character+of+string+mdn
11- console . log ( initials )
11+ console . log ( initials ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,6 @@ console.log(`The base part of ${filePath} is ${base}`);
2020const dir = filePath . slice ( 0 , lastSlashIndex ) ;
2121const ext = base . slice ( base . lastIndexOf ( "." ) + 1 ) ;
2222
23- console . log ( ext )
23+ console . log ( ext ) ;
2424
25- // https://www.google.com/search?q=slice+mdn
25+ // https://www.google.com/search?q=slice+mdn
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
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
1010
11- console . log ( num )
11+ console . log ( num ) ;
1212
1313//math.floor is round down the number returns to largest integer less than or equal to a given number.
1414//math.random() could generate the number from 0 to <1 b random.
1515//maximum refer to 100 and minimum refer to 1.
16- //The calculation of num is different everytime because of math.random(). smallest value of num is 1. And largest is 100.
16+ //The calculation of num is different everytime because of math.random(). smallest value of num is 1. And largest is 100.
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?
33
4- //adding // before the lines.
4+ //adding // before the lines.
Original file line number Diff line number Diff line change 33let age = 33 ;
44age = age + 1 ;
55
6- console . log ( age )
6+ console . log ( age ) ;
77
8- //The error is "Assignment to constant variable." Constant value could not be alternated.
9- //if line 3 const changed to let the code could be executed.
8+ //The error is "Assignment to constant variable." Constant value could not be alternated.
9+ //if line 3 const changed to let the code could be executed.
Original file line number Diff line number Diff line change 44const cityOfBirth = "Bolton" ;
55console . log ( `I was born in ${ cityOfBirth } ` ) ;
66
7-
8- //Initiation should access before the declaration.
7+ //Initiation should access before the declaration.
Original file line number Diff line number Diff line change 11const cardNumber = 4533787178994213 ;
22const last4Digits = cardNumber . toString ( ) . slice ( - 4 ) ;
33
4- console . log ( last4Digits )
4+ console . log ( last4Digits ) ;
55
66// The last4Digits variable should store the last 4 digits of cardNumber
77// However, the code isn't working
88// Before running the code, make and explain a prediction about why the code won't work
99// Then run the code and see what error it gives.
1010// Consider: Why does it give this error? Is this what I predicted? If not, what's different?
1111// Then try updating the expression last4Digits is assigned to, in order to get the correct value
12-
12+
1313//slice is for text or array only. Need to change card number from number to text. use toString() to convert cardNumber
14- //from integer to string.
14+ //from integer to string.
Original file line number Diff line number Diff line change @@ -2,4 +2,4 @@ const twelveClockTime = "8:53pm";
22const twentyFourHourClockTime = "20:53" ;
33
44//integer and number could not start for the initiation.
5- //SyntaxError: Invalid or unexpected token - print before modified the initiation.
5+ //SyntaxError: Invalid or unexpected token - print before modified the initiation.
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ console.log(result);
2323// divided 60. And the remainingSecond is 24.
2424
2525// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
26- //A: totalMinutes get the result form movieLength (8784) minus remainingSecond (24). The result is 8760.
26+ //A: totalMinutes get the result form movieLength (8784) minus remainingSecond (24). The result is 8760.
2727//The totalMinutes is 8760 divide 60 = 146.
2828
2929// e) What do you think the variable result represents? Can you think of a better name for this variable?
You can’t perform that action at this time.
0 commit comments