title: What is the difference between == and === in JavaScript?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/359494/javascript-vs-does-it-matter-which-equal-operator-i-use">Javascript === vs == : Does it matter which &ldquo;equal&rdquo; operator I use?</a><br>
    <a href="https://stackoverflow.com/questions/2132878/when-would-javascript-make-more-sense-than">When would JavaScript == make more sense than ===?</a>  </p>
  </blockquote>
  
  
  
  <p>What is the difference between below methods in  comparing a string with undefined value.  </p>
  
  <pre><code> var x; 
   if(x==undefined) 
   { 
    alert(x); 
   }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>if(x===undefined)
  { 
    alert(x); 
  }
  </code></pre>
  
  <p>Why should i prefer second method in this case.. Please let me know advantages.. </p>