title: why do both if('0'==false) and if('0') evaluate to true in Javascript?
body: <p>So for what I know is that the <code>if</code> statement in Javascript casts the result of its condition to a Boolean, and then executes it likes the following</p>
  
  <pre><code>if(true) {
      // run this
  }
  
  if(false) {
      // do not run this
  }
  </code></pre>
  
  <p>And that works. But If I do this:</p>
  
  <pre><code>if('0' == false) {
      // We get here, so '0' is a falsy value
  }
  </code></pre>
  
  <p>Then I would expect this </p>
  
  <pre><code>if('0') {
      // We don't get here, because '0' is falsy value
  }
  </code></pre>
  
  <p>But instead I get</p>
  
  <pre><code>if('0') {
      // We *DO* get here, even though '0' is falsy value
  }
  </code></pre>
  
  <p>So what's happening? Apparently, <code>if</code> does not check if its condition a truthy or falsy value, but does some other conversion?</p>