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