append character ( ' a ' + i ) in resultant String ' result ' by min ( count1 [ i ] , count2i ] ) times
{ for ( var j = 1 ; j <= min ( count1 [ i ] , count2 [ i ] ) ; j ++ ) { result += String . fromCharCode ( 97 + i ) ; } } document . write ( result ) ; }