-
-
Notifications
You must be signed in to change notification settings - Fork 261
London|25-ITP-September|Alexandru Pocovnicu|Sprint 1| Coursework #719
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 14 commits
d543994
a7cc13e
cb1e645
2d115ce
f6b6842
a4b365b
f8be9ec
6631cd9
357720b
f6c81bf
54c1b63
62b453f
9264771
2cb91c3
6b61b4c
c77d6f3
fc023eb
5945501
f091869
ab656e8
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,3 @@ | ||
| 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? | ||
| // By commenting out the lines |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,17 @@ | ||
| const cardNumber = 4533787178994213; | ||
| const last4Digits = cardNumber.slice(-4); | ||
| // const cardNumber = 4533787178994213; | ||
| // const last4Digits = cardNumber.slice(-4); | ||
|
|
||
|
|
||
|
|
||
| // The last4Digits variable should store the last 4 digits of cardNumber | ||
| // However, the code isn't working | ||
| // Before running the code, make and explain a prediction about why the code won't work | ||
| // Then run the code and see what error it gives. | ||
| // Consider: Why does it give this error? Is this what I predicted? If not, what's different? | ||
| // Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
|
|
||
|
|
||
| //prediction: it won't work because the value of cardNumber is a number and slice() is a string method | ||
| const cardNumber = "4533787178994213"; | ||
| const last4Digits = cardNumber.slice(-4); | ||
| console.log(last4Digits); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,7 @@ | ||
| const 12HourClockTime = "20:53"; | ||
| const 24hourClockTime = "08:53"; | ||
| // const 12HourClockTime = "20:53"; | ||
| // const 24hourClockTime = "08:53"; | ||
|
|
||
| //the name of a variable can not start with a number | ||
|
|
||
| const twelveHourClockTime = "20:53"; | ||
| const twenty4hourClockTime = "08:53"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,14 +12,20 @@ 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? | ||
| //6 variable declarations | ||
|
|
||
| // b) How many function calls are there? | ||
| //1 function call | ||
|
|
||
| // c) Using documentation, explain what the expression movieLength % 60 represents | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators | ||
| //% it's the remainder operator and it tells us how many seconds are left out of a whole minute | ||
|
|
||
| // d) Interpret line 4, what does the expression assigned to totalMinutes mean? | ||
| //total time in minutes without the remaining seconds | ||
|
|
||
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
| //"Movie length" | ||
alexandru-pocovnicu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer | ||
| //it will work with all values as long as they are numbers, | ||
|
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. consider all the edge cases - are there any inputs that might give strange formatting?
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. i have tried from 0 to 5464557657, it seems to be working, is there something i'm not seeing? 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. The formatting is trying to be HH:MM:SS. Are there any cases where it doesn't give a format exactly like HH:MM:SS? Because this variable is formatted like HH:MM:SS, if a developer looked at it, would the suggested variable name
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. i added "0" as padding and changed the name to timeInHhMmSs, but to answer your first question if the hours would be in the 100s then the format would be HHH... etc |
||
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.
What is difficult to understand about the MDN docs?
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.
I can't really point to one thing which I don't understand, in the end I just copy/paste into chat gpt and ask it to explain