title: JavaScript comparison operators: Identity vs. Equality
body: <p>I've been trying to understand the difference between JavaScript's comparison operators: identity and equality. From what I've read, if you check the equality of two objects using ==, JavaScript will try to figure out if they are the same type and, if not, try to get them to that same type. However, === doesn't behave in the same manner. So as an example:</p>
  
  <pre><code>var n = "1";
  console.log(n==1);        // outputs true
  console.log(n===1);       // outputs false
  </code></pre>
  
  <p>So what is the difference between these "identity" operators and the regular equality operators? What is the benefit of having both? </p>
  
  <p>Are there differences in performance? I would think that the identity operator would be faster since it doesn't do conversion.</p>
  
  <p>Also, how do these differ when it comes to more complex objects, like arrays? Most importantly, what do conventions say about when one should be used over the other, why?</p>