is it appropriate to use a ternary operator here?
<p>I have a variable that checks the length of some values; if one fails, <code>var pass</code> is set to <code>false</code>. Another fucntion checks the validity of an email address and sets it to false if it doesn't pass the test. I'm trying to make a custom error message.</p>

<p>Is it better to use a ternary operator like this, or a nested if-statement. Or is there a much simpler way to do it?</p>

<pre><code>var mail = true;
var pass = true;
var err = '';

(mail &amp;&amp; pass) ? err = 'mail and pass both true' : (!mail &amp;&amp; pass) ? err = 'not mail and is pass' : (mail &amp;&amp; !pass) ? err = 'is mail and not pass' : err = 'neither pass nor mail';
</code></pre>

<p><a href="http://jsfiddle.net/loren_hibbard/4SfTj/" rel="nofollow">fiddle</a></p>

<p>Thanks!</p>
