我试图找出这个Javascript代码的错误 函数entertimesTable(timesTable、timesStart、timesEnd) { while(timestart
您的while语句中有一个不匹配的我试图找出这个Javascript代码的错误 函数entertimesTable(timesTable、timesStart、timesEnd) { while(timestart,javascript,Javascript,您的while语句中有一个不匹配的(): function entertimesTable (timesTable,timesStart,timesEnd) { while (timesStart<=timesEnd) { document.write(timesTable + " * " + timesStart + "= " + timesTable*timesStart + "<br />"); timesStart+
(
):
function entertimesTable (timesTable,timesStart,timesEnd)
{
while (timesStart<=timesEnd)
{
document.write(timesTable + " * " + timesStart + "= " + timesTable*timesStart + "<br />");
timesStart++;
}
}
var timesTable;
while ((timesTable=prompt("Please enter a table to use",-1) != -1)
{
while (isNaN(timesTable) == true)
{
timesTable=prompt(timesTable + "is not a valid number, please retry", -1);
}
if (timesTable == -1)
{
break;
}
document.write("<br />The" + timesTable + " times table <br />");
entertimesTable(timesTable,1,12);
}
将该行修改为:
while ((timesTable=prompt("Please enter a table to use",-1) != -1) //3 left parens and 2 right parens
你想做什么?你想从哪里调用这些方法?你面临什么错误?你能发布所有需要代码才能理解的内容吗?在这个答案中你期望得到什么?在第13行告诉一些例子语法错误你在
中的!=
之前错过了一个额外的偏执,而中的帽子更换谢谢你这么有效!我觉得自己很笨,但对我来说这是一个很好的学习点。
while ((timesTable=prompt("Please enter a table to use",-1)) != -1)