Condition to check whether the element at i , is greater than its next neighbouring element or not .
if ( arr [ i ] < arr [ i + 1 ] ) document . write ( arr [ i ] + " " ) ; else document . write ( arr [ i ] + " " ) ; } }