[英]Expected an identifier and instead saw ')'
I receive this error, 我收到此错误,
Expected an identifier and instead saw ')'.
in this lines of code. 在这行代码中。 Any how to fix it?
有没有怎么解决?
for (; index < nPageFullItemCnt; index++) {
strIndex = "0" + index;
keyIndex = "popup_item_" + strIndex.substr(strIndex.length - 2, 2);
keyItem = document.getElementById(keyIndex);
setPopupKeyText(keyIndex, " ");
keyItem.className = "popupLangItemNone";
keyItem.langId = "";
}
You're not passing in the first parameter to the for()
loop: 您没有将第一个参数传递给
for()
循环:
for (index = 0; index < nPageFullItemCnt; index++)
{
/* .. */
}
This bit: 这一点:
for (; index
Is causing that error. 导致该错误。 The code should validate if you do this:
代码应验证您是否执行此操作:
for (0; index
(As I assume you're not passing the first parameter, on purpose) (因为我假设你没有传递第一个参数,故意)
However, I'd suggest using a while
loop, instead of a for, if you're not going to make use of the [initialization]; [condition]; [final-expression]
但是,如果你不打算使用
[initialization]; [condition]; [final-expression]
,我建议使用while
循环,而不是for [initialization]; [condition]; [final-expression]
[initialization]; [condition]; [final-expression]
[initialization]; [condition]; [final-expression]
properties in a for
loop. for
循环中的[initialization]; [condition]; [final-expression]
属性。
while(index < nPageFullItemCnt){
// Do stuff;
index++;
}
Technically, the 3 parameters are all optional, but some code validators can throw a error if they're missing. 从技术上讲,3个参数都是可选的,但是如果缺少某些代码验证器可能会抛出错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.