-1
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:

https://i.sstatic.net/ITqV3.jpg

3 Answers 3

4

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]
}
Sign up to request clarification or add additional context in comments.

1 Comment

+1 @NT3RP for getting those ternary operators out of there. Code should be written to be read. Save the ternaries for minification, obfuscation, and pluralizing.
2

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

1

You have an assignment operator floating around in the middle of that expression. Remove it and it should be syntactically correct.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.