Find the maximum element from both the arrays
var x = a . reduce ( function ( a , b ) { return Math . max ( a , b ) ; } ) ; var y = b . reduce ( function ( a , b ) { return Math . max ( a , b ) ; } ) ; document . write ( x + " " + y ) ; }