var rets = [2,4,5,6,7,9,10,15]; var max = arrs[0]; for(var i = 1,ilen = arrs.length; i < ilen; i++) { if(arrs[i] > max) { max = arrs[i]; } } console.log(max);