I have a complex array structure and I am looking for a way to calculate the sum of all numbers without using Array.isArray method:
let arr = [[1, 2, 3, [4, 5, [6, 7]]], [8, [9, 10]]];
An ideal solution would transform the array like this:
let arr = [[1, 2, 3, 4, 5], [6, 7, 8], [9, 10]];
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
If you have any suggestions on how to accomplish this task, please share them with me.