jase
5/4/2018 - 9:36 AM

Populate table with data from an array

This sample demonstrates how to populate an HTML table with data from an array.

var table = document.getElementById("table");

for(var record of parsedData) {
    var tableRow = table.insertRow(parsedData.indexOf(record + 1));
    var attributeCell = tableRow.insertCell(0);
    var valueCell = tableRow.insertCell(1);

    attributeCell.innerHTML = record.attribute;
    valueCell.innerHTML = record.value;
}