title: String Comparison Issue in JavaScript
body: <p>I was looking at a Function that Django uses to get the CSRF Token, when you need to validate a user session, using Jquery and JavaScript. Here is the code:</p>
  
  <pre><code>function getCookie(name) {
      var cookieValue = null;
      if (document.cookie &amp;&amp; document.cookie != '') {
          var cookies = document.cookie.split(';');
          for (var i = 0; i &lt; cookies.length; i++) {
              var cookie = jQuery.trim(cookies[i]);
              // Does this cookie string begin with the name we want?
              if (cookie.substring(0, name.length + 1) == (name + '=')) {
                  cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                  break;
              }
          }
      }
      return cookieValue;
  }
  var csrftoken = getCookie('csrftoken');
  </code></pre>
  
  <p>You can also see the code online here on the djangoproject website, <a href="https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax">here</a>.</p>
  
  <p>Okay, now when I paste this code, I get a light warning from my IDE saying this:</p>
  
  <p><code>Binary operation argument type String is not assignable to type HTMLCollection</code></p>
  
  <p>What does it mean by this? The error is on this line:</p>
  
  <pre><code>document.cookie &amp;&amp; document.cookie != ''
  </code></pre>