Driver program to test above function
var ar1 = [ 1 , 12 , 15 , 26 , 38 ] ; var ar2 = [ 2 , 13 , 17 , 30 , 45 ] ; var n1 = ar1 . length ; var n2 = ar2 . length ; if ( n1 == n2 ) document . write ( " " + getMedian ( ar1 , ar2 , n1 ) ) ; else document . write ( " " ) ;