functional programming

Javascript reduce function on array of objects

Array.reduce() function in javascript is one of the most interesting functions, but it may be tricky if you haven’t worked with it on array of objects. Let us first look at the following code (array of plain integers), the code basically sums up all the elements in the array: [js] [1, 2, 3].reduce((accumulator, element) => […]