In my code, there is a div containing 3 tables.
var x = tempDiv.getElementsByClassName("hiscore_table");
I can confirm this because when I log it in the console, it shows like this:
https://i.sstatic.net/iYBB8.png
To organize the tables, I create a new div to append them to:
var newDiv = document.createElement('div');
for (let i = 0; i < x.length; i++) {
newDiv.appendChild(x[i]);
}
However, when I append the new div to the body, only 2 tables are visible. After debugging, I noticed that the loop is only running 2 times even though x.length returns 3. I suspect that when I append child, it might be deleting the tables from the old div, causing this issue.