I have got the current code https://jsfiddle.net/rjw3f7yu/5/ that can plot table in HTML using Javascript code. However, there is this line that pops up stating "undefined" between row 1 and 2. Anyone knows what could be the problem here?
I am using bootstrap v3 just for extra info. Thanks!
HTML code:
<table class="table" id="wconclusiontable">
</table>
Javascript Code:
var counttopercentagec1event = [0, 1, 2, 3, 4, 5];
var counttopercentagec2event = [2, 33, 22, 32, 43, 52];
var counttopercentagec3event = [7, 17, 72, 37, 47, 51];
function wconclusiontable() {
var wtable = document.getElementById("wconclusiontable");
var row;
row += "<thead><tr><th>" + "Event #" + "</th>";
row += "<th>" + "Low" + "</th>";
row += "<th>" + "Medium" + "</th>";
row += "<th>" + "High" + "</th>";
row += "</tr></thead>";
for (var i = 2; i < 5; i++) {
row += "<tbody><tr><td>" + (i-1) + "</td>";
row += "<td>" + counttopercentagec1event[i-1] + "%" + "</td>";
row += "<td>" + counttopercentagec2event[i-1] + "%" + "</td>";
row += "<td>" + counttopercentagec3event[i-1] + "%" + "</td>";
row += "</tr></tbody>";
}
wtable.innerHTML = row;
}
wconclusiontable();