The program below is used to add the four ranges with the ranges array and display the result 139.
(20 - 1) + (11930 - 11904) + (12020 - 11931) + (6 - 1) = 139
However, I cannot quite understand the use of the start parameter and the zero (0) in the code.
Help me understand how they are processed in the program.
Thanks
let ranges = [[1,20],[11904, 11930],[11931, 12020],[1,6]];
console.log(ranges.reduce((start, [from, to]) =>{
return start + (to - from);
}, 0));