Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job setting up the custom sort2 method and using a bubble sort algorithm. Your overall approach is solid, but this requires a small change before it can be approved.
There is a typo in your sorting logic that is causing a ReferenceError, which breaks the functionality. Inside your inner loop in src/arrayMethodSort.js, you are trying to access err[j+1], but the variable err is not defined. You likely meant to use the array itself, so changing err to arr should resolve the issue.
Once that's fixed, the function should work as expected. Keep up the great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
src/arrayMethodSort.js
Outdated
|
|
||
| for (let i = 0; i < arr.length; i++) { | ||
| for (let j = 0; j < arr.length - 1 - i; j++) { | ||
| if (compare(arr[j], err[j+1]) > 0) { |
There was a problem hiding this comment.
It seems there's a typo here. The variable err is not defined in this scope. You probably meant to use arr instead.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this! I'm happy to approve your solution. You've successfully fixed the ReferenceError from the last review, and your custom sort2 method now works perfectly. The logic for handling both the default sort and the optional compareFunction is implemented correctly. As a suggestion for future improvement, you could explore more efficient sorting algorithms like Merge Sort or Quick Sort, but for this task, your bubble sort implementation is great.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.