Driver code
var arr = [ 6 , 1 , 7 , 2 , 8 , 4 ] ; var n = arr . length ; var b = Array ( 2 ) . fill ( 0 ) ; var tranFee = 2 ; max_profit ( arr , b , n , tranFee ) ; document . write ( b [ 0 ] + " " + b [ 1 ] ) ;