title: Javascript array equal to zero but not itself
body: <p>I've been playing around with arrays in JavaScript and cannot figure out why this happens:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log(0 == 0)
  //true
  
  console.log([] == 0)
  //true
  
  console.log(0 == [])
  //true
  
  console.log([] == [])
  //false
  
  console.log([] == ![])
  // true</code></pre>
  </div>
  </div>
  </p>
  
  <p>The empty array is equal enough to zero both left and right, but why isn't it equal to itself?</p>
  
  <p>I realise that comparing two objects would not result <code>true</code>, but why are they coerced to <code>0</code> (or falsy, which shouldn't be the case) if you compare them to <code>0</code>, while threated as an object if you compare them to the other array?</p>