js array.reduce

array.reduce(function(acc,val){

  return acc + val;

},0)

累加数组。

posted @ 2017-05-03 12:12  三里路异乡客  阅读(123)  评论(0)    收藏  举报