How can I fill a variable length HTML table from JavaScript

I need to fill in an HTML table from JS (I have just started with JS). Here is my code based on an example I found: length = Table.length const Table = document.getElementById("TblBody") for ( i = 0; i

How can I fill a variable length HTML table from JavaScript

I need to fill in an HTML table from JS (I have just started with JS). Here is my code based on an example I found:

length = Table.length
const Table = document.getElementById("TblBody")
for ( i = 0; i

I expected to see about 20 rows of five columns each filled with data. The results I got with the above code: the headers displayed as expected boxes for the first two columns were displayed neither box had any data