-
-
Notifications
You must be signed in to change notification settings - Fork 389
West Midlands | May 2026 | Muhammad-Burhan Mustafa | Sprint 1 | Module-Structuring-and-Testing-Data #1442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
West Midlands | May 2026 | Muhammad-Burhan Mustafa | Sprint 1 | Module-Structuring-and-Testing-Data #1442
Changes from all commits
3ee7d43
733c53e
84d4de9
5957240
06435e4
5b08905
c921f4a
b9828e4
7e158fa
44189f3
b83c9fc
792b135
87a31a3
b6b5341
add60e5
2f73154
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| This is just an instruction for the first activity - but it is just for human consumption | ||
| We don't want the computer to run these 2 lines - how can we solve this problem? | ||
| // This is just an instruction for the first activity - but it is just for human consumption | ||
| // 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 |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| var age = 33; | ||
| age = age + 1; | ||
|
|
||
| console.log(age); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| // Currently trying to print the string "I was born in Bolton" but it isn't working... | ||
| // what's the error ? | ||
| // We were trying to call a the variable before it was even initialized / made. | ||
|
|
||
| console.log(`I was born in ${cityOfBirth}`); | ||
| const cityOfBirth = "Bolton"; | ||
| console.log(`I was born in ${cityOfBirth}`); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
| const civilTime = "8:53pm"; | ||
| const continentalTime = "20:53"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| const movieLength = 8784; // length of movie in seconds | ||
| const movieLength = "839f"; // length of movie in seconds | ||
|
|
||
| const remainingSeconds = movieLength % 60; | ||
| const totalMinutes = (movieLength - remainingSeconds) / 60; | ||
|
|
@@ -12,14 +12,15 @@ console.log(result); | |
| // For the piece of code above, read the code and then answer the following questions | ||
|
|
||
| // a) How many variable declarations are there in this program? | ||
|
|
||
| // Answer: There is 6 variable declarations | ||
| // b) How many function calls are there? | ||
|
|
||
| // Answer: There is one function call on line 10 | ||
| // c) Using documentation, explain what the expression movieLength % 60 represents | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators | ||
|
|
||
| // Answer: this finds the remainder of movieLength when its divided by 60 | ||
| // d) Interpret line 4, what does the expression assigned to totalMinutes mean? | ||
|
|
||
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
|
|
||
| // Answer: The expressions uses the modulo function to work out the remainder value which in this case works out the remaining seconds of the total movie length | ||
|
Comment on lines
-23
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Part (e) has a second question. Could you also answer that?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: The file where I left this comment was
Comment on lines
-23
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You deleted question (e) in your file. The original question is; The variable which question (e) refers to is the one named |
||
| // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer | ||
| // Answer: No it only works as intended when a Non negative integer is used however when Decimal, negative, or string values it does not work as intended. | ||
| // Decimal values will display decimal seconds, which does not cause an error, but the output may not be in the expected time format. | ||
| // Negative values will produce negative time values, and string values may produce NaN if they cannot be converted into a number. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use
letinstead ofvar.Note: Feel free to use AI to find out why use of 'var' is not recommended.