-
-
Notifications
You must be signed in to change notification settings - Fork 546
London | 26-Sept- ITP | Hugh Mills| Sprint 2| Sprint 2 Coursework #1527
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
Open
HM-127BTY
wants to merge
14
commits into
CodeYourFuture:main
Choose a base branch
from
HM-127BTY:coursework/sprint-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
37a0f59
Adding answers for 1-count.js
HM-127BTY c0c59e9
Done task for 2-initials.js
HM-127BTY 5f618f9
completed codes for 3-paths.js
HM-127BTY 14355ac
Done the answers for 4-random.js
HM-127BTY cf5f0dc
Found error and added comment for 0.js
HM-127BTY a50c7a7
TypeError for 1.js
HM-127BTY 4c7f5d9
ReferenceError for 2.js
HM-127BTY 04de5cb
Error for 2.js is ReferenceError and gave suggestion
HM-127BTY a1b1cf8
changed //
HM-127BTY 1dc53ce
this is a SyntaxError for 4.js
HM-127BTY 647c50a
Answered the questions in the comments area in 1-percentage-change.js
HM-127BTY 29409f8
added a spaced line at 28 to make it easier to read for comments
HM-127BTY 655acb6
Answered questions in 2-time-format.js
HM-127BTY 1d0edb2
answered the questions to 3-to-pounds.js
HM-127BTY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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? | ||
|
|
||
| // giving SyntaxError | ||
| // You need to add // to each line or /* before the first line and */ after the last one to make it a comment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,22 @@ | ||
| 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 | ||
|
|
||
| /* | ||
| cardNumber is giving a number and that can't be used for slice, could not remember the name for that error at this time. | ||
| after running the code it shows thats a TypeError. cardNumber.slice is not a function | ||
| */ | ||
|
|
||
| const cardNumber = 4533787178994213; | ||
| let number = cardNumber.toString() | ||
| const last4Digits = number.slice(-4); | ||
| console.log(last4Digits) | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,8 @@ | ||
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
|
|
||
| // This is a Syntax error as cant have numbers for an identifier at the start of it. | ||
| // Changing to say: time12HourClock would work | ||
|
|
||
| // const time12HourClock = "8:53pm"; | ||
| // const time24hourClock = "20:53"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,32 @@ | ||
| const movieLength = 8784; // length of movie in seconds | ||
| // const movieLength = 8784; // length of movie in seconds | ||
|
|
||
| const remainingSeconds = movieLength % 60; | ||
| const totalMinutes = (movieLength - remainingSeconds) / 60; | ||
| // const remainingSeconds = movieLength % 60; | ||
| // const totalMinutes = (movieLength - remainingSeconds) / 60; | ||
|
|
||
| const remainingMinutes = totalMinutes % 60; | ||
| const totalHours = (totalMinutes - remainingMinutes) / 60; | ||
| // const remainingMinutes = totalMinutes % 60; | ||
| // const totalHours = (totalMinutes - remainingMinutes) / 60; | ||
|
|
||
| const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`; | ||
| console.log(result); | ||
| // const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`; | ||
| // 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? | ||
| // There are 6 variable declarations, lines 1,3,4,6,7,9 | ||
|
|
||
| // b) How many function calls are there? | ||
| //1 at 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 | ||
| //This is using a remainder, this us seeing how many times 8784 goes into 60 and what is remaining which is 24 in this case: | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder | ||
|
|
||
| // d) Interpret line 4, what does the expression assigned to totalMinutes mean? | ||
| // It is the sum of movieLength minus remainingSeconds then divided by 60 | ||
|
|
||
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
| // its showing the length of the movie in hours, minutes and seconds, could be better called something like MovieDuration | ||
|
|
||
| // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer | ||
| //Yes it will as long as the input is numerical numbers only, it does not work with any extra symbols, spaces or letters. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The error is not because it is being called again, it is because you are trying to reassign it to another value.