JavaScript语法错误

|
out += (out ? rogueArray[14] : rogueArray[13]) + arrayItem + ((vanWilder[arrayItem] !== null) ? = + encodeURIComponent(vanWilder[arrayItem]) : rogueArray[13]);
直到[Dreamweaver中的[arrayItem]为止,这里都可能存在语法错误。有什么帮助吗? 这是DreamWeaver中的图像: http://i.stack.imgur.com/ITqV3.jpg     
已邀请:
分解你写的东西...
out += (
    out ?
        rogueArray[14] :
        rogueArray[13]
    ) +
    arrayItem +
    (
        (vanWilder[arrayItem] !== null) ?
        //Oh no! What\'s this assignment doing here?
        = + encodeURIComponent(vanWilder[arrayItem]) : rogueArray[13]);
同样,如果您执行以下操作,则调试代码会更容易:
if (out) {
    out += rogueArray[14]
} else {
    out += rogueArray[13]
}
out += arrayItem

if (vanWilder[arrayItem] !== null) {
    out += encodeURIComponent(vanWilder[arrayItem])
} else {
    out += rogueArray[13]
}
    
我不确定是什么? = +表示,但实际上,如果仅编写此代码,那么这行代码太多了。将其分解为单独的行,使用临时变量,然后将其重构为紧凑的带有嵌套三级运算符的衬里,如果您确实需要的话,请一次完成此步骤。     
您在该表达式的中间有一个赋值运算符。删除它,并且在语法上应该正确。     

要回复问题请先登录注册