I have the following code which is supposed to get the clientHeight
of certain elements and map them in a 2D array.
let columns = document.getElementsByClassName('_3Rcdf');
let cellHeights = new Array();
for (let row=0; row<columns[0].children.length; row++) {
for (let j=0; j<columns.length; j++) {
cellHeights[row, j] = columns[j].children[row].querySelector("._1KV2M").firstChild.firstChild.clientHeight;
}
}
console.log(cellHeights);
The log outputs the following: [151, 170, 151]
rather than the output of
[
[151,170,151],
[151,151,151],
[151,190,190],
[151,170,151]
]
What I am identifying is that the code is overwriting the values within the array with the latest 3 values, rather than creating a new array inside it. How can I fix this?