I have a list (array) of matrixes in a data structure like so:

```
const data = [
  {
    matrix: {
      rows: {
        ROW1: {
          cols: {
            COL1: "4",
            COL2: "2"
          }
        },
        ROW2: {
          cols: {
            COL1: "1",
            COL2: "4"
          }
        },
        ROW3: {
          cols: {
            COL1: "2",
            COL2: "1"
          }
        }
      }
    },
  },
  {
    matrix: {
      rows: {
        ROW1: {
          cols: {
            COL1: "1",
            COL2: "6"
          }
        },
        ROW2: {
          cols: {
            COL1: "2",
            COL2: "3"
          }
        },
        ROW3: {
          cols: {
            COL1: "5",
            COL2: "2"
          }
        }
      }
    }
  }
];

```

I would like to sum up the values defined at the same ROW:COL pairs and end up with a single matrix like so:

```
const newMatrix = {
  rows: {
    ROW1: {
      cols: {
        COL1: "5",
        COL2: "8"
      }
    },
    ROW2: {
      cols: {
        COL1: "3",
        COL2: "7"
      }
    },
    ROW3: {
      cols: {
        COL1: "7",
        COL2: "3"
      }
    }
  }
};

```

I do not know beforehand how many matrixes I might receive in the data array. I also do not know beforehand how many rows and columns I receive.

I started off by calling reduce() on the data but got stuck because I cannot think of a way of finding and then summing up the data at ROW:COL pairs of the same name.

```
const newMatrix = data.reduce(( accumulator, current ) => {
  let newMatrix;
  // ...???
  // find? forEach? Object.entries? for loops? maps inside maps? 
  // Everything I tried failed
  return newMatrix;
});

```

I have also messed around with forEach(), Object.values(), find() and all sorts of for loops inside other loops but I keep ending up in some kind of brain loop myself.

I realise this might not be enough to work yet but I'm new at programming and don't know where to go next. 

I have been stuck for 2.5 days now on this very problem so even if no straight up solution is offered I would appreciate any tips or guidance in the right direction.

Unfortunately I have no peers who I can ask for help.

Thank you.