-
-
Notifications
You must be signed in to change notification settings - Fork 387
Cape Town | 25-ITP-May | Asanda Dunn | Sprint 1 | Coursework/sprint 1 #1392
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?
Changes from all commits
8f010c7
c330ae9
556342c
80b6d23
5c82350
58b13c8
ea10174
c994a4e
7ab5791
aff8855
c580390
6be81b5
996180e
ed06b15
7deb9ec
7742a7b
28bd937
65f5441
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,5 @@ | ||
| 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? | ||
| // We don't want the computer to run these 2 lines - how can we solve this problem? | ||
|
|
||
| // This is a a syntax error. This text is supposed to be commented out in order for us to not run into this error | ||
| // we should add // so that the computer doesn't try to run this text as code . | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| // trying to create an age variable and then reassign the value by 1 | ||
|
|
||
| const age = 33; | ||
| let age = 33; | ||
| age = age + 1; | ||
|
|
||
| // the variable age has been declared as constant in order to fix this age will | ||
| // need to be declared using let so that it's values can be reassigned |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| // Currently trying to print the string "I was born in Bolton" but it isn't working... | ||
| // what's the error ? | ||
|
|
||
| console.log(`I was born in ${cityOfBirth}`); | ||
| const cityOfBirth = "Bolton"; | ||
| console.log(`I was born in ${cityOfBirth}`); | ||
|
|
||
|
|
||
| // The variable city of birth needs to be declared first before attempting to | ||
| // print the string |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
| const TwelveHourClockTime = "8:53pm"; | ||
| const TwentyFourHourClockTime = "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 = 10652; // length of movie in seconds | ||
|
|
||
| const remainingSeconds = movieLength % 60; | ||
| const totalMinutes = (movieLength - remainingSeconds) / 60; | ||
|
|
@@ -23,3 +23,18 @@ console.log(result); | |
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
|
|
||
| // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer | ||
|
|
||
| // Answers | ||
|
|
||
| // a) 6 | ||
|
|
||
| // b) One function call is on this code - console.log() in line 10. | ||
|
|
||
| // c) The remainder (%) operator returns the remainder left over when one operand is divided by a second | ||
| // operand. It always takes the sign of the dividend. | ||
|
|
||
| // d) In line 4 the totalHours is calculated by subtracting the remainingMinutes from the totalMinutes and then dividing that answer by 60 | ||
|
|
||
| // e) It is a string representing the time movie time in hours, minutes and seconds | ||
|
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. Do you think the variable name "result" is clear enough that this is what the string represents? |
||
|
|
||
| // f) yes, because the variables for calculating the results use a formulas that will work with any number that is assigned to the movieLength variable | ||
|
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. It will run without errors, but are there any edge cases that give odd outputs? |
||
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.
Good work finding these. Are there any more functions on line 4/5?