reduce of empty array with no initial value code example

Example 1: typescript loop over map with value as array

myMap.forEach((value: boolean, key: string) => {
    console.log(key, value);
});

Example 2: how to apply reduce to an empty array in javascript

[].reduce(function(previousValue, currentValue){
  return Number(previousValue) + Number(currentValue);
}, 0);

Example 3: how to apply reduce to an empty array in javascript

[].reduce( (previousValue, currentValue) => previousValue + currentValue, 0);