var arr = [1,2,3,4,5,6,7,8,9,10,11,12], r = arr.slice(0,10).reduce(function(x,y){ return x+y; }); alert(r);
注意:slice(0,10)函数是取前面十个数字