-
-
Notifications
You must be signed in to change notification settings - Fork 206
Manchester | ITP-May-2025 | Chukwuemeke Ajuebor | Sprint 1 | Data-Groups-Arrays #771
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
Manchester | ITP-May-2025 | Chukwuemeke Ajuebor | Sprint 1 | Data-Groups-Arrays #771
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 (Module-Data-Groups) doesn't match expected format (example: 'Sprint 2', without quotes) |
1 similar comment
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Sprint part (Module-Data-Groups) doesn't match expected format (example: 'Sprint 2', without quotes) |
|
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) doesn't match expected format (example: 'Sprint 2', without quotes) |
|
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) doesn't match expected format (example: 'Sprint 2', without quotes) |
LonMcGregor
left a comment
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 on this sprint. I have left comments on some files for you to think about.
Also, did you mean to commit the prep folder?
| const nums = list.filter(x => typeof x === 'number' && !isNaN(x)); | ||
| if (nums.length === 0) return null; | ||
|
|
||
| const sorted = [...nums].sort((a, b) => a - b); |
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.
Why are you expanding an array into an array here? Can you think of a way to simplify this?
| const middleIndex = Math.floor(sorted.length / 2); | ||
| let median; | ||
| if (sorted.length % 2 !== 0) { | ||
| median = sorted.slice(middleIndex, middleIndex + 1)[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.
Think about when you want to use slicing to access arrays, and what you are trying to do here. Is there a way to get a value from an array that might be better suited than slicing for this line of code?
|
|
||
| // Given an array with both positive and negative numbers | ||
| // When passed to the max function | ||
| // Then it should return the largest number overall |
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 think you may have misunderstood what the program specification is asking for here. Try to think about what your understanding is generally - does your code behave consistently when given mixed numbers and only negative numbers?
Learners, PR Template
Self checklist
Changelist
In this PR I learned about working more with arrays.
I learned about mixing for loops with if statements to return desired results for a function.
Questions
Ask any questions you have for your reviewer.