1. Array.prototype.selectionSort = function() {
    2. for (let i = 0; i < this.length - 1; i += 1) {
    3. let indexMin = i;
    4. for (let j = i; j < this.length; j += 1) {
    5. if(this[j] < this[indexMin]) {
    6. indexMin = j
    7. }
    8. }
    9. const temp = this[i];
    10. this[i] = this[indexMin];
    11. this[indexMin] = temp;
    12. }
    13. console.log(this);
    14. return this
    15. }
    16. const arr = [5, 4, 3, 2, 1];
    17. arr.selectionSort()