Skip to content

add solution#2482

Open
Kateryna7465 wants to merge 2 commits intomate-academy:masterfrom
Kateryna7465:develop
Open

add solution#2482
Kateryna7465 wants to merge 2 commits intomate-academy:masterfrom
Kateryna7465:develop

Conversation

@Kateryna7465
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example


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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems there's a typo here. The variable err is not defined in this scope. You probably meant to use arr instead.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants