Initialize first and second minimums . It is assumed that the array has at least two elements .
let first_min = Math . min ( arr [ 0 ] , arr [ 1 ] ) ; let second_min = Math . max ( arr [ 0 ] , arr [ 1 ] ) ;