我正在尝试使用我已经声明的主代码中的数组在javascript中创建一个简单的表但是它一直告诉我这行代码的错误 -
function setTable();
错误是 - 未捕获的SyntaxError:意外的令牌;
这是我的功能 -
function setTable() {
var toTable = "<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><center><table border=1>";
toTable += "<tr> <td>country</td> <td>gold</td> <td>civillians</td> <td>warriors</td> <td>wood</td> <td>metal</td> <td>land</td> <td>food</td> <td>happiness</td> </tr>";
for(var i = 0; i < NumOfPeople - 1; i++) {
toTable = toTable + "<tr> <td>" + country[i] + "</td> <td>" + gold[i] + "</td> <td>" + civillians[i] + "</td> <td>" + warriors[i] + "</td> <td>" + wood[i] + "</td> <td>" + metal[i] + "</td> <td>" + land[i] + "</td> <td>" + food[i] + "</td> <td>" + happiness[i] + "</td></tr>";
}
document.write(toTable);
}