js_array-method-sort_solution#2481
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this task! Your custom sort2 method is well-implemented and correctly added to the Array.prototype. It successfully handles both the default string-based comparison and a custom compare function, meeting all the requirements. As a suggestion for future projects, you might explore more efficient sorting algorithms like Quicksort or Merge Sort, as your bubble sort implementation can be slow for large arrays. Your solution is approved, keep up the great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
src/arrayMethodSort.js
Outdated
| return 0; | ||
| }; | ||
|
|
||
| for (let i = 0; i < this.length; i++) { |
There was a problem hiding this comment.
This bubble sort implementation is functionally correct. For future tasks or real-world applications, you might want to consider more efficient sorting algorithms like Merge Sort or Quick Sort, as bubble sort's performance (O(n^2)) can be slow for large arrays.
No description provided.