Driver Code
let arr = [ - 6 , - 3 , - 1 , 2 , 4 , 5 ] ; let n = arr . length ; document . write ( " " + " " ) ; for ( let i = 0 ; i < n ; i ++ ) document . write ( arr [ i ] + " " ) ; sortSquares ( arr ) ; document . write ( " " + " " ) ; document . write ( " " + " " ) ; for ( let i = 0 ; i < n ; i ++ ) document . write ( arr [ i ] + " " ) ;