Javascript program to implement the above approach
function printArray ( array , Length ) { document . write ( " " ) ; for ( let i = 0 ; i < Length ; i ++ ) { document . write ( array [ i ] ) ; if ( i < ( Length - 1 ) ) document . write ( " " ) ; else document . write ( " " ) ; } } function reverse ( array , start , end ) { while ( start < end ) { let temp = array [ start ] ; array [ start ] = array [ end ] ; array [ end ] = temp ; start ++ ; end -- ; } }