why does if("string") evaluate "string" as true but if ("string"==true) does not?
<p>Given the following code:</p>

<pre><code>if ("string") {
    console.log('true!');
}
//logs "true" to the console
if ("string"==true) {
    console.log('true!');
}
//doesn't log anything
</code></pre>

<p>Why does this happen? I thought <code>"string"</code> was being cast to a number, as is the boolean. So <code>true</code> becomes <code>1</code>, and <code>"string"</code> becomes <code>NaN</code>. The second if statement makes sense, but I don't see why the first statement causes the inner loop to be evaluated. What's going on here?</p>
