Should I use the ternary operator or the || operator in JavaScript?
<p>I have found two ways of coding a conditional assignment, but both give the same result:</p>

<pre><code>function onClickEvent(e){ 
    e = win.event || e,  //These are
    var ev=e.target || e.srcElement;  // good?
    alert(ev.innerHTML);
}
</code></pre>

<p>or</p>

<pre><code>function onClickEvent(e){
    e = (win.event) ? win.event : e;  //or
    var ev = (e.target) ? e.target : e.srcElement; // these are?
    alert(ev.innerHTML);
}
</code></pre>

<p>Is one approach preferred over the other? If yes, why?</p>
