title: Is it necessary to use === to compare strings in Javascript or is == enough?
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>  </p>
  </blockquote>
  
  
  
  <p>I can understand why <code>===</code> is necessary when comparing numbers, booleans, empty strings, etc, due to unexpected type conversions e.g.</p>
  
  <pre><code>var foo = 1; 
  var bar = true; 
  // bar == foo =&gt; true
  // bar === foo =&gt; false
  </code></pre>
  
  <p>But can  <code>==</code> ever introduce a bug when comparing a variable to a <strong><em>non-empty</em></strong> string literal?  Is it more efficient to use <code>==</code> over <code>===</code> in this case?</p>