If you are trying to print out the contents of a JavaScript array into the DOM as a table, then have a look at the following example.
var firstNames = ['Marc', 'John', 'Drew', 'Ben'];
var lastNames = ['Wilson', 'Smith', 'Martin', 'Wilcox'];
var htmlStr = "<tbody>";
for(int i=0; i < firstNames.length; ++i) {
htmlStr += "<tr>";
htmlStr += "<td>" + firstNames[i] + "</td>";
htmlStr += "<td>" + lastNames[i] + "</td>";
htmlStr += "</tr>";
}
htmlStr += "</tbody>"
In this example I have created the tbody
of your table and then populated it with the contents of your two arrays. I have split it into more steps than needed so that it is easier to see what is going on. Once you understand what is going on here, you can add the header to this and then add it to the DOM.