let array = [[1,4], [11], [3,5,7]];
console.log(0+array[0]+array[1]+array[2]);
console.log(array.reduce((acc, value)=>acc+value, 0));
This prints the following on the console :
01,4113,5,7
01,4113,5,7
I was trying to add all elements of the array and stumbled upon the above code. I know the spread operator and how I can add all the elements. I know what's happening here is concatenation and not addition. I am just not able to understand this output. Can someone tell me what is happening here?