I currently use this code to iterate through a .json file:
for (f = 0; f < forum.length; f++) {
end = columnArray.length - 1;
object = forum[f];
for (property in object)
{
value = object[property];
if (property === columnArray[end]) {
tableRowData = "<td>" + value + "</td></tr>";
} else {
tableRowData = "<td>" + value + "</td>";
}
tableRowData2 += tableRowData;
tableRowData = "";
}
finalTableData = "<tr>" + tableRowData2;
finalTableData2 += finalTableData;
tableRowData2 = "";
}
JSLint doesn't like the idea of using for/in loops to iterate through arrays. Was trying to write it as a standard:
for (i = 0; i < forum.length; i++) {}
But got stuck. This is probably simple, but I cannot see what the logic should be for some reason.
Thanks.