title: Javascript falsy values (null, undefined, false, empty string: "" or '' and 0) and comparison(==) operator
body: <p>When I am using any one of values(<code>null</code>, <code>undefined</code>, <code>false</code>, <code>''</code>, <code>0</code>) in a <code>if</code> statement, it is always evaluated as fallacy(<code>false</code>). Also, the negation of these values((<code>null</code>, <code>undefined</code>, <code>false</code>, <code>''</code>, <code>0</code>) in a <code>if</code> statement always evaluated as tautology(<code>true</code>).</p>
  
  <pre><code> if(null){
   }else{
   }
  
   if(undefined){
   }else{
   }
  
   if(false){
   }else{
   }
  
   if(''){
   }else{
   }
  
   if(0){
   }else{
   }
  </code></pre>
  
  <p>In all the above cases, <code>if</code> statement is evaluated as <code>false</code> &amp; <code>else</code> statement executes. 
  However, when I am comparing these fallacy values with <code>==</code> operator, it is not returning <code>true</code> always. Surprisingly, it is always returning <code>true</code> values when I am comparing the negation of these values. </p>
  
  <p>if double equalto (<code>==</code>) operator checks/compares for values &amp; not strictly for types, then why:</p>
  
  <pre><code>null == false          // returns false
  
  null == 0              // returns false
  
  null == ''             // returns false
  </code></pre>
  
  <p>But, </p>
  
  <pre><code>!null == !false       // returns true
  
  !null == !0           // returns true
  
  !false == !undefined  // returns true
  </code></pre>
  
  <p>And,</p>
  
  <pre><code>null == undefined     // returns true
  
  false == 0            // returns true
  </code></pre>
  
  <p>I appreciate if any one can clarify the behavior or relationship among these values(<code>null</code>, <code>undefined</code>, <code>false</code>, <code>''</code>, <code>0</code>).</p>