title: If class exists, do something with Javascript
body: <p>I have a class and if it exists, I want to use the variable as a true/false if statement.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="snake" class="snake--mobile"&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>var isMobileVersion = document.getElementsByClassName('snake--mobile');
  if (isMobileVersion !== null)
    alert('xx');
  </code></pre>
  
  <p>However, it’s not working. Any ideas? No jQuery answers, please.</p>