London | 26-Jan-ITP | Angela McLeary | Sprint 1|Coursework/sprint 1#990
London | 26-Jan-ITP | Angela McLeary | Sprint 1|Coursework/sprint 1#990AngelaMcLeary wants to merge 20 commits intoCodeYourFuture:mainfrom
Conversation
LonMcGregor
left a comment
There was a problem hiding this comment.
Good work on these tasks.
To figure out the difference between a function and a method,you need to consider objects (you may or may not have come across these yet in your study). Functions are written by you, methods are written as part of objects. This is a good site with an exaplantion: https://www.geeksforgeeks.org/javascript/difference-between-methods-and-functions-in-javascript/
Does that help you understand the difference?
Sprint-1/1-key-exercises/4-random.js
Outdated
|
|
||
| // In this exercise, you will need to work out what num represents? | ||
| //*Answer: | ||
| //Number returns a random whole number between 1 and 100. |
There was a problem hiding this comment.
Can you figure out the limits more precisely? Think about if it includes or excludes those numbers?
There was a problem hiding this comment.
@LonMcGregor Thanks for your question.
I can see it is not very clear. "num" returns a random whole number between 1 and 100 inclusive. It can never go below 1 or over 100.
Sprint-1/2-mandatory-errors/4.js
Outdated
| // When declaring a variable it must not start with a number, space or reserved word. | ||
| // to fix this, we can rename them correctly. | ||
|
|
||
| const twelve_HourClockTime = "20:53"; |
There was a problem hiding this comment.
here you have mixed variable naming using snake_case and PascalCase. Can you see the difference?
There was a problem hiding this comment.
@LonMcGregor thanks for your feedback.
I have mixed them up, I see that I should use camelCase for functions and variables. I will update the code.
Thank you
Angela.
| // 1200 returned 0:20:00 | ||
| // 92383.7 returned 25:39:43.69999999999709 | ||
| // -8784 returned -2:-26:-24 | ||
| // it worked with all numbers including decimals and negative numbers. |
There was a problem hiding this comment.
Just note that when you tested these, though it ran without errors, does the output look OK, or are there values where it looks incorrect?
There was a problem hiding this comment.
@LonMcGregor another good question.
Line 46: Milliseconds appeared in the output because they were part of the input and were not explicitly removed, even though they were not required and it does make the output not what is expected.
Line 47: Negative numbers passed the test. In reality there should not be negative time in the movieLength and it should throw an error.
In both cases there was no validation to stop this from occurring.
Thank you
Angela.
Learners, PR Template
Self checklist
Changelist
This PR is focused on understanding the existing codebase and deepening my knowledge of JavaScript concepts.
It involves interpreting the current implementation, analyzing how different parts interact, identifying and understanding errors, and using Chrome DevTools to inspect runtime behavior and debug issues.
Questions
What is the difference between a function and a methods?