-
-
Notifications
You must be signed in to change notification settings - Fork 194
London | 25-ITP-Sep| Sophia Mohamed | Sprint 1 | Sprint 1 Coursework #854
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
cjyuan
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.
Can you check if any of this general feedback can help you further improve your code?
https://github.com/CodeYourFuture/Module-Data-Groups/blob/sprint-1-feedback/Sprint-1/feedback.md
Doing so can help reviewers speed up the review process. Thanks.
|
median.js dedupe.test.js Sprint-1/implement/sum.test.js |
Sprint-1/fix/median.js
Outdated
| // 4) Sort a copy numerically (don't mutate the original) | ||
| const sorted =[...numbers].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.
numbers is not the original array, and it is not needed afterward.
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.
Thanks for the feedback!
I removed the unnecessary clone ([...numbers])
| expect(result).toEqual([1, 2, 3, 4]); | ||
| expect(result).not.toBe(arr); // important check |
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.
Nicely done.
Sprint-1/implement/max.test.js
Outdated
| // Given an array with only non-number values | ||
| // When passed to the max function | ||
| // Then it should return the least surprising value given how it behaves for all other inputs | ||
| test.todo("given an array with only non-number values, returns the least surprising value given how it behaves for all other inputs"); |
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 test has not been implemented. (You would have to replace the least surprising value by an exact value which you expect)
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.
Thanks so much for spotting those issues!
I went back and fixed the incorrect variable name inside max.js, removed some leftover code from the median exercise, and updated the test that was still calling calculateMedian.
Everything now works as expected, and all tests pass.
Really helpful feedback — thank you!
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 function in this file has has not yet been refactored to meet the spec on line 1.
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.
Thanks for the feedback!
You're right — I had not refactored the includes function yet.
I've now updated the implementation so that it meets the requirement on line 1 and added tests to confirm it works as intended.
cjyuan
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.
Changes look good. Well done!
Sprint-1/fix/median.js
Outdated
| if (numbers.length === 0) return null; | ||
|
|
||
| // 4) Sort a copy numerically (don't mutate the original) | ||
| const sorted =[...numbers].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.
You can also consider introducing a variable with a more meaningful name as
const sorted = numbers.sort((a, b) => a - b);
Learners, PR Template
Self checklist
Changelist
I have completed all mandatory tasks.
Questions