Sort an array when two halves are sorted | Javascript program to Merge two sorted halves of array Into Single Sorted Array ; Sort the given array using sort function ; Driver code ; Print sorted Array
function mergeTwoHalf ( A , n ) { A . sort ( ( a , b ) => a - b ) ; } var A = [ 2 , 3 , 8 , - 1 , 7 , 10 ] ; var n = A . length ; mergeTwoHalf ( A , n ) ; for ( var i = 0 ; i < n ; i ++ ) document . write ( A [ i ] + " " ) ;