Driver program to test above
let mat = [ [ 5 , 4 , 7 ] , [ 1 , 3 , 8 ] , [ 2 , 9 , 6 ] ] ; let n = 3 ; document . write ( " " + " " ) ; printMat ( mat , n ) ; sortMat ( mat , n ) ; document . write ( " " ) ; document . write ( " " + " " ) ; printMat ( mat , n ) ;