I need the solution for the general case
for example
let data = [['a', 'b'],['c', 'd'],['e', 'f', 'g', 'h']];
I need this:
{
"a": {
"c": {
"e": 0,
"f": 0,
"g": 0,
"h": 0
},
"d": {
"e": 0,
"f": 0,
"g": 0,
"h": 0
}
},
"b": {
"c": {
"e": 0,
"f": 0,
"g": 0,
"h": 0
},
"d": {
"e": 0,
"f": 0,
"g": 0,
"h": 0
}
}
}
and data can be any random array of arrays... I tried a recursive approach but I get stuck with Map and .fromEntries method...