我正在尝试重写一个插件,以便它通过 JSLint。我在 300 行脚本中写了大约 3 行,但我被困在这里:
var __slice = [].slice,
__indexOf = [].indexOf || function (item) {
var i = 0,
l = this.length;
for (i < l) <<<<< this is where the error is
{
if (i in this && this[i] === item)
return i;
}
i+=1;
return -1;};
错误是
"Expected ';' and instead saw ')'.
for (i < l)
我不确定如何重写它以适应他们的约定。建议?