Manchester | ITP-May-2025 | Chukwuemeke Ajuebor | Sprint 1 | Data-Groups-Arrays#771
Manchester | ITP-May-2025 | Chukwuemeke Ajuebor | Sprint 1 | Data-Groups-Arrays#771AjueborChukwuemeke wants to merge 6 commits intoCodeYourFuture:mainfrom
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.
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.
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.
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.
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.