-
-
Notifications
You must be signed in to change notification settings - Fork 275
West Midlands | ITP Sept 25 | Georgina Rogers | Sprint 1 | Structuring and Testing Data #761
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?
Conversation
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Sprint part (Sprint-1) doesn't match expected format (example: 'Sprint 2', without quotes) If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Sprint part (Sprint-1) doesn't match expected format (example: 'Sprint 2', without quotes) If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Sprint part (Sprint-1) doesn't match expected format (example: 'Sprint 2', without quotes) If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Sprint part (Sprint-1) doesn't match expected format (example: 'Sprint 2', without quotes) If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Sprint part (Sprint-1) doesn't match expected format (example: 'Sprint 2', without quotes) If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Sprint part (Sprint-1) doesn't match expected format (example: 'Sprint 2', without quotes) If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Sprint part (Sprint-3) doesn't match expected format (example: 'Sprint 2', without quotes) If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
|
@sambabib hi, I see you have changed the label to "in review" a week ago, but I don't see any comments about the work. Please let me know. Thank you |
hi, apologies. thanks for the nudge, I am reviewing it right now. I have done a fair bit of travelling this week. |
| let initials = ``; | ||
|
|
||
| // https://www.google.com/search?q=get+first+character+of+string+mdn | ||
| let initials = firstName[0] + middleName[0] + lastName[0]; |
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.
this simple solution works, so well done! however, there might be a better way to do this. think about if you ever had a lot more name variables and you had to provide a solution that automatically populates the initials.
| const dotIndex = base.lastIndexOf("."); | ||
| const ext = base.slice(dotIndex); | ||
| // dotIndex finds position of the last . in the base string and slice extracts after this | ||
| console.log(`The base part of the file path is ${base}, the dir part is ${dir}, and the ext part is ${ext}`); |
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.
solid solution. shows that you understand the slice() method and how to use it on strings.
| // num is an integer between minimum and maximum, between 1 and 100 inclusive | ||
| // math.random() produces a decimal between 0 (inclusive) and 1 (exclusive) | ||
| // math.floor() rounds down to the nearest integer | ||
| // (maximum - minimum + 1)) + minimum chooses a number between minimum and maximum and adds 1 so its inclusive of maximum |
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 explainer.
| // Then try updating the expression last4Digits is assigned to, in order to get the correct value | ||
|
|
||
| // slice is a method that works on strings, not numbers. | ||
| // To fix the error, we can convert cardNumber to a string using the toString() method before calling slice. |
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 catch. but if the variable is given as a number and you have converted toString(), you should make a conversion back, so you can return a number. when you begin to work with strongly-typed languages, cardNumber may not be of type string. this is where you must return the original variable type unless otherwise stated.
| // Line 10: console.log(`The percentage change is ${percentageChange}`) prints percentage change to output | ||
|
|
||
| // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? | ||
| // Line 5 is missing a comma in the replaceAll function call. This is causing a syntax error because the function expects two arguments, but only one is provided. |
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 catch.
|
|
||
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
| // The variable result represents the total length of the movie in hours, minutes and seconds. | ||
| // A better name for this variable could be movieDuration or movieFormattedLength. |
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.
movieDuration makes for better reading. ideally, we always want to keep our variable names as clear as possible so the meaning can be inferred at first glance.
having said that, movieFormattedLength also works because it piggybacks off the initial movieLength declaration. however, movieFormattedLengthToMinutes might be better, since we can easily tell what it's been formatted to.
| // For 399, start index is character 1 (the first 9) so this returns 99. | ||
| .padEnd(2, "0"); | ||
| // Ensures pence string has at least 2 characters by adding trailing zeros if needed | ||
| // So 5p would become 005 and this would return 05. |
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.
excellent explanation.
Self checklist
Changelist
Completed all practice questions for sprint 1 coursework backlog
Questions