var test = 'test'; var add = function(a, b) { return a + b; }; [0, 1, 2, 3, 4].reduce(add, 0); // 10