标签:
1 var values = [1,2,3,4,5]; 2 var sum = values.reduceRight(function(prev,cur,index,array){ 3 return prev+cur; 4 }); 5 6 console.log(sum);//15
JavaScript归并方法reduce()和reduceRight()
原文地址:http://www.cnblogs.com/liubeimeng/p/5504357.html