title: Get element by PART of class name [JavaScript]
body: <p>I'm trying to make a chrome extension. A part of the code (early on in the making of this extension) involves fetching several elements by their class name. There are several elements whos class name all look like this: "scollerItem [AlotOfRandomCharacters]".
  So I'm trying to list all classNames that start with "scrollerItem", but i'm not quite sure how to go about it.</p>
  
  <p>So here's my code so far:</p>
  
  <pre><code>function initRE(){
      var matchingItems = [];
      var allElements = document.getElementsByTagName("div");
      for(i=0; i &lt; allElements.length; i++)
      {
          if ( allElements [i].className == "scrollerItem" &amp;&amp; "*" )
          {
              matchingItems.push(allElements[i]);
          }
      }
      alert(matchingItems[0]);
  }
  </code></pre>
  
  <p>allElements is listed in the breakpoint watchlist as "HTMLCollection(623)" (roughly), but nothing is forwarded to the "matchingItems" array.
  I've tried <code>[i].className.contains</code> and <code>.includes</code></p>
  
  <p>Direct copy of one of the HTML Elements in question:</p>
  
  <pre><code>&lt;div class="scrollerItem s1d8yj03-2 ebdCEL Post t3_agnhuk  s1ukwo15-0 RqhAo" id="t3_agnhuk" tabindex="-1"&gt;
  </code></pre>