我在运行 Chrome 扩展时遇到的错误如下:
未捕获的语法错误:意外的 token 返回engine.js:295
这里是第 293 到 295 行,因此更容易调试:
for (var i = 0; i < document.head.childNodes.length; i++)
if (tryReplace(document.head.childNodes[i])
return
我没有正确返回吗?解决办法是什么?
最佳答案
第二行括号的顺序不正确:
function someFunc() {
for (var i = 0; i < document.head.childNodes.length; i++)
// Inserted missing parentheses at the end of the expression.
if (tryReplace(document.head.childNodes[i]))
return
}
return
语句只能在函数上下文中使用。
关于javascript - Chrome 扩展程序 : Uncaught SyntaxError: Unexpected token return,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35256431/