我在第一次迭代中未定义任何评论对我有帮助提前谢谢
for (i = 0; i <= nummonth; i++) {
var res = compound * (Math.pow(interest, i));
res = res.toFixed(0);
var tableHTML;
var interestgained = (+res * interest)-res;
interestgained = interestgained.toFixed(0);
var powint = compound * (Math.pow(interest, i));
powint = powint.toFixed(0);
var tr = powint - compound;
var ointerest = (interest - 1)*100;
ointerest = ointerest.toFixed(0);
tableHTML = tableHTML + "<tr><td>Compound: " + i + "</td><td> " + "$"+res + "</td><td> " + ointerest + "%"+"</td><td> " + "$"+interestgained + "</td><td>"+ "$"+powint +"</td></tr>";
}