out += (out ? rogueArray[14] : rogueArray[13]) + arrayItem + ((vanWilder[arrayItem] !== null) ? = + encodeURIComponent(vanWilder[arrayItem]) : rogueArray[13]);
There is supposedly a syntax error here on the line up until [arrayItem in Dreamweaver. Any help?
Here is image of it in DreamWeaver:
3 Answers 3
Breaking down what you've written...
out += (
out ?
rogueArray[14] :
rogueArray[13]
) +
arrayItem +
(
(vanWilder[arrayItem] !== null) ?
//Oh no! What's this assignment doing here?
= + encodeURIComponent(vanWilder[arrayItem]) : rogueArray[13]);
As well, it would be easier to debug your code if you did something like the following:
if (out) {
out += rogueArray[14]
} else {
out += rogueArray[13]
}
out += arrayItem
if (vanWilder[arrayItem] !== null) {
out += encodeURIComponent(vanWilder[arrayItem])
} else {
out += rogueArray[13]
}
1 Comment
I'm not sure what ? = + means, but really, that's too much going on in one line if you're just writing this. Break it apart into separate lines, use temporary variables, and then refactor it down to a compact one liner with nested tertiary operators if you really need to after it works, doing this one step at a time.
Comments
You have an assignment operator floating around in the middle of that expression. Remove it and it should be syntactically correct.