reduce of empty array with no initial value at array.reduce code example
Example 1: how to apply reduce to an empty array in javascript
[].reduce( (previousValue, currentValue) => previousValue + currentValue, 0);
Example 2: how to apply reduce to an empty array in javascript
[].reduce(function(previousValue, currentValue){
return Number(previousValue) + Number(currentValue);
}, 0);