Ternary Operators in JavaScript Without an "Else"
Posted
by Oscar Godson
on Stack Overflow
See other posts from Stack Overflow
or by Oscar Godson
Published on 2010-05-28T21:50:58Z
Indexed on
2010/05/28
21:52 UTC
Read the original article
Hit count: 185
I've been using them forever, and I love them. To me they see cleaner and i can scan faster, but ever since I've been using them i've always had to put null
in the else conditions that don't have anything. Is there anyway around it? E.g.
condition ? x=true : null ;
basically, is there a way to do:
condition ? x=true;
Now it shows up as a syntax error...
© Stack Overflow or respective owner