As part of a classroom assignment, I am working on creating a table using only Javascript. The table is set up perfectly, except that every other row displays a random number before moving on to the next row. How can I eliminate this random row?
var table = ["Name", "Turn Average", "Surface Area", "100% Boosting"];
var names = ["Octane", "Dominus", "Breakout", "X-Devil", "Batmobile"];
var turnaverages = [2.18, 2.22, 2.22, 2.21, 2.25];
var surfacearea = [34495, 34529, 32679, 34242, 34365];
var maxboost = [1.967, 2.031, 2.035, 2.014, 2.10];
function info() {
document.write("<table>");
document.write("<tr>");
//these lines represent the headings for the columns in the table
document.write("<th>Name</th>");
document.write("<th>Turn Average</th>");
document.write("<th>Surface Area</th>");
document.write("<th>100% Boosting</th>");
document.write("</tr>");
for(var i = 0; i < names.length; i++){
document.write("<tr>");
document.write("<td>" + names[i] + "</td>");
document.write("<td>" + turnaverages[i] + "</td>');
document.write("<td>" + surfacearea[i] + '</td>');
document.write('<td>' + maxboost[i] + '</td>');
document.write('</tr>');
if ( names[i] === "Dominus" ) {
document.write('<td>' + turnaverages[i] + surfacearea[i] + maxboost[i] + '</td>');
}
else if ( names[i] === "Breakout" ){
document.write('<td>' + turnaverages[i] + surfacearea[i] + maxboost[i] + '</td>');
}
else if ( names[i] === "X-Devil" ){
document.write('<td>' + turnaverages[i] + surfacearea[i] + maxboost[i] + '</td>');
}
else if( names[i] === "Batmobile" ){
document.write('<td>' + turnaverages[i] + surfacearea[i] + maxboost[i] + '</td>');
}
document.write('</tr>');
}
document.write('</table>');
}