title: Javascript says two strings are equal but they are not equal
body: <p>I have faced with the weird behavior where comparison says that two strings are equal when they are obviously not equal: AngularJS project, I am injecting to config some property via <em>"@@propertyName"</em>:</p>
  
  <pre><code>states = '@@states'
  </code></pre>
  
  <p>where <code>"states": []</code> in another config file.</p>
  
  <p>and lately I want to do the following comparison:</p>
  
  <pre><code>if (states === '@@states') {
      states = ''
  }
  </code></pre>
  
  <p>Which means that if <em>states</em> were not injected - do it an empty string.
  Strange behavior here is that even if <em>states</em> contain "{}" or "[]" or an array of object it is becomes an empty although values are not equal:</p>
  
  <p><a href="https://i.stack.imgur.com/QrCDx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QrCDx.png" alt="incorrect if"></a></p>
  
  <p>And it happens only for objects, arrays or array of object, if <em>states</em> is a string like "testtest" - comparison works correctly.</p>
  
  <p>I have found a workaround but I'm still interesting in what is going on. Maybe you know it and can explain it. Thanks!</p>