I don’t think I am using the ternary operator correctly as I am not getting the results am I after:
buildHTML.push("<a href='http://mysite/user?screen_name=" + data.friend == null ? data.user.me : data.friend + "'>" + data.friend == null ? data.user.me : data.friend + "</a>");
This gives me null if friend is null, and gives me friend if friend is not null
It should be giving me me if friend is null and friend if friend is not null.
What am I doing wrong?
Wrap up the ternary logic:
You may also need to check to see whether
data.friendis == or === tonull.