If arr [ i ] is in between first and second then update second
else if ( arr [ i ] < second && arr [ i ] != first ) second = arr [ i ] ; } if ( second == Number . MAX_VALUE ) document . write ( " " ) ; else document . write ( " " + first + " " + " " + second + ' ' ) ; }