SOURCE

const array = [8, 3, 2, 4, 5, 0]

const findSecond = arr => {
  let first = second = arr[0]
  
  arr.map(item => {
    if (item < first) {
      second = first
      first = item
    }
    
    if (item < second && item !== first) {
      second = item
    }
  })

  return second
}

console.log(findSecond(array))
console 命令行工具 X clear

                    
>
console