So here’s an interesting thing I came across:
var arrays = [[1, 2, 3], [4, 5], ];
return a + b;
I was playing around with Array.reduce and Array.concat, and started wondering what would happen if I tried to add up the total of all elements in the variable arrays. I didn’t quite get what I was expecting.
var a = [1,2,3];
var b = [2,3,4];
console.log(a + b);
Apparently, the + operator acts to concatenate arrays. It recognizes commas, but the brackets confuse it somehow?
If anyone has a good explanation of this I’d love to hear it.