I understand the concept of reduce, but I am struggling with a multidimensional array. Can someone help me with transforming this:
y = [['x', 0.5], ['x', 0.5], ['z', 2], ['z', 2]];
into this:
y = [['x', 1], ['z', 4]];
Appreciate any assistance!