Check if current element is less than then update third
else if ( array [ i ] < thirdmin ) thirdmin = array [ i ] ; } document . write ( " " + firstmin + " " ) ; document . write ( " " + secmin + " " ) ; document . write ( " " + thirdmin + " " ) ; }