Skip to main content


reduces the array to a single value

reduce(callback: (acc: any, item: any) => any, acc: any): any;


  • callback: function - a function that will be called for each item in the array. The function takes two parameters:
    • acc - the initialValue, or the previously returned value of the function
    • item - the current item of a data collection
  • acc: any - a value to be passed to the function as the initial value


A single output value.


const total =, item) {
return acc + item.value;
}, 0);

Related sample: Data. Reduce