Rationale for why JavaScript converts primitive values to numbers in == operator comparisons when one is boolean?
<p>I know the rule: </p>

<blockquote>
  <p>If the two operands are not of the same type, JavaScript converts the operands then applies strict comparison. If either operand is a number or a boolean, the operands are converted to numbers if possible; else if either operand is a string, the other operand is converted to a string if possible.</p>
</blockquote>

<p>So, <code>if("true")</code> passes but <code>if("true" == true)</code> fails because it is handle like  <code>if(NaN == 1)</code>. </p>

<p>I was wondering what the rational is behind this when one value is boolean.  In other weak typed languages like php, this is handle this differently--if one value is a boolean, the other is converted to a boolean for comparisons (and not covert both to numbers as in javascript).</p>

<p>I'm assuming this choice was made for the <code>==</code> operator on careful consideration.  Can anyone provide rational as to why this was the chosen functionality?  Is there a common use case that this was chosen to address?  I'm betting is wasn't just a mistake.</p>
