loop from bottom to top same as the bubble sort
for ( let i = start ; i < end - 1 ; ++ i ) { if ( a [ i ] > a [ i + 1 ] ) { let temp = a [ i ] ; a [ i ] = a [ i + 1 ] ; a [ i + 1 ] = temp ; swapped = true ; } }