-2
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

asked Apr 14, 2011 at 2:25

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]
}
answered Apr 14, 2011 at 2:29
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.

answered Apr 14, 2011 at 2:29

Comments

1

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

answered Apr 14, 2011 at 2:27

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.