1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
   |  let sort = function (arr) {     let change = true     let t = 0     while(change) {         change = false         for (let x = 0; x < arr.length-1; x++) {             if (arr[x] > arr[x+1]) {                 t = arr[x]                 arr[x] = arr[x+1]                 arr[x+1] = t                 change = true             }         }     }
      return arr }
 
  let sort2 = function (arr) {     let change = true     let t = 0     let l = arr.length-1     while(change && l >0) {         change = false         for (let x = 0; x < l ; x++) {             if (arr[x] > arr[x+1]) {                 t = arr[x]                 arr[x] = arr[x+1]                 arr[x+1] = t                 change = true             }         }         l--     }
      return arr }
 
  |