javascript: surprising order of operations
<p>I recently wrote code that didnt work as i would expect, it was:</p>

<pre><code>message = 'Thank You';
type = 'success';

message = message || type == 'success' ? 'Success' : 'Error';
</code></pre>

<p>It was news to me that at the end of that <code>message</code> was set to <strong>'Success'</strong>.</p>

<p>I would think that since the truthy value of message is <code>true</code>, the right side of the <code>or</code> would <strong>not</strong> evaluate.</p>

<p>Parenthesis around the right side of the OR solved this, but i still dont understand why the right <em>side was evaluated at all</em> </p>
