Is there an equivalent of ? : operator of C# in Javascript/Jquery?
<p>I want to write the following C# code equivalent in JavaScript/jQuery</p>

<pre><code>(x == 0 &amp;&amp; y &lt; 0 ? x : x+y)
</code></pre>

<p>Is there an equivalent shorthand way such as above in JavaScript/jQuery or will I have to write the whole if else. </p>

<p>I need to put such a condition in the for loop definition, </p>

<pre><code>for (i=0; i&lt; (x == 0 &amp;&amp; y &lt; 0 ? x-y : x+y); i++)
</code></pre>

<p>and thus was wondering if there is a way I could do something similar in JavaScript. As far as I know, I will have to write an if else, compute the value and then use that value. But perhaps somebody knows a better way?</p>
