REDUCE METHOD IN JS NODE code example
Example 1: reduce javascript
let sum = arr.reduce((curr, index) => curr + index);
Example 2: syntax of reduce in js
[1,2,3,4,5].reduce((acc, current)=>acc+current, 0)
let sum = arr.reduce((curr, index) => curr + index);
[1,2,3,4,5].reduce((acc, current)=>acc+current, 0)