// basic sample var total = [0, 1, 2, 3].reduce(function(a, b) { return a + b; }); // sample with array - count the occurrence of each word var list = null; list = ['hi','boo','boo','hello','ada','ada','ada']; var result = list.reduce(function(previous,current){ if (current in previous) { previous[current] += 1; } else{ previous[current] = 1; } return previous; },{}); // result={hi: 1, boo: 2, hello: 1, ada: 3} // total=6