I need to output a multi column table that reads left to right. The table image shows how it should look with just the first few toys. I have to output the table using the DOM node. I also need to generate a sequential code number in the code column. I have been racking my brain over this so any help would be appreciated.

var productsArr = new Array('ToyA', 'ToyB', 'ToyC', 'ToyD', 'ToyE', 'ToyF', 'ToyG', 'ToyH');
var pricesArr = new Array(18.70, 11.95, 39.95, 49.95, 54.65, 32.10, 18.70, 11.95);
for (var i = 0; i < productsArr.length; i++) {
document.writeln('<table border="1">');
document.writeln('<tr>');
document.writeln('<th>Code</th>');
document.writeln('<th>Product</th>');
document.writeln('<th>Price</th>');
document.writeln('</tr>');
document.writeln('<tr>');
document.write("<td>Generate Number</td>" + "<td>" + productsArr[i] + "</td>" + "<td>" + pricesArr[i] + "</td>")
document.writeln('</tr>');
document.writeln('</table>');
}
document.writeever existed and learn to use DOM functions likedocument.createElementanddocument.addChild. Your code is from the 90's.appendChild?