Lets say I have data structured like this
let array = [[1], [2], [3]]
and I want to use those elements as an index:
console.log(matrix[1][2][3])
Is there a way to break out those elements? I am trying to get the logic nailed down for n
elements.
Here is what I have:
const getValue = (coords: []) => {
let array = [];
for (let i = 0; i < coords.length; i++) {
array.push([coords[i]]);
}
console.log(complex[array]);
};
But I get the error:
Type 'never[][]' cannot be used as an index type.ts(2538)