const a = [1,3,6,9,2,4,7,9,8]

let highest = a[0]
let secondHighest = a[0]
for(val of a){
	if(val > highest){
      	highest = val   
    }else if(val < highest && val > secondHighest){
        secondHighest = val
    }
}


console.log(secondHighest)

 

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: