title: Click HTML element A and add Class on B with pure JavaScript
body: <p>I can't see what I'm doing wrong here.. Can anyone help please?</p>
  
  <p>JavaScript:</p>
  
  <pre><code>function toggleMainNav() {
          var navLink = document.getElementsByClassName('nav_link')[0];
          var mainNav = navLink.nextSibling;
          if ( mainNav.className.match(/(?:^|\s)inactive(?!\S)/) ){
              mainNav.className = 'active';
          } else{
              mainNav.className = 'inactive';
          }
      }
  
      document.getElementsByClassName('nav_link')[0].addEventListener( 'click' , toggleMainNav );
  </code></pre>
  
  <p>this is the HTML:</p>
  
  <pre><code>&lt;a class="nav_link"&gt;☰ Menu&lt;/a&gt;
  &lt;ul class="inactive"&gt;
  &lt;/ul&gt;
  </code></pre>