代码改变世界

查出第二大的数是多少

2019-07-11 17:42  qgbo  阅读(270)  评论(0)    收藏  举报
 1 
  arr=[4,3,5,9,1,12,89,2,44] 3 for(t of arr){ 4 5 6 if(t> max) 7 max=t; 8 else { 9 if(t>sec) 10 sec=t; 11 } 12 console.log(max,sec,t) 13 }

这个代码查出 第二大的数是多少