Printing the array before sorting
for ( let i = 0 ; i < n ; i ++ ) { document . write ( i + " " + arr [ i ] + " " ) ; } document . write ( " " ) ; selectionSort ( arr , n ) ; document . write ( " " + " " ) ;