Don't know why the table isn't being sorted into rows and columns correctly. I am attempting to create a two dimensional array, and then use nested for loops to automatically create a table.
list = [
[12, 4, 22],
[11, 32, 7],
[9, 16, 13]
];
for (var i = 0; i < list.length; i++) {
tablebody.innerHTML += "<tr>";
for (var j = 0; j < list[i].length; j++) {
tablebody.innerHTML += "<td>" + list[i][j] + "</td>";
}
tablebody.innerHTML += "</tr>"
}
body {
background-color: black;
color: white;
}
<table id="table">
<thead id="tablehead">
<tr>List[0]</tr>
<tr>List[1]</tr>
<tr>List[2]</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>